diff --git a/lib/data/models/static/document_status_model.dart b/lib/data/models/static/document_status_model.dart new file mode 100644 index 000000000..9e5dfa23e --- /dev/null +++ b/lib/data/models/static/document_status_model.dart @@ -0,0 +1,32 @@ +// Package imports: +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +// Project imports: +import 'package:invoiceninja_flutter/data/models/entities.dart'; + +part 'document_status_model.g.dart'; + +class DocumentStatusFields { + static const String name = 'name'; +} + +abstract class DocumentStatusEntity extends Object + with EntityStatus, SelectableEntity + implements Built { + factory DocumentStatusEntity() { + return _$DocumentStatusEntity._( + id: '', + name: '', + ); + } + + DocumentStatusEntity._(); + + @override + @memoized + int get hashCode; + + static Serializer get serializer => + _$documentStatusEntitySerializer; +} diff --git a/lib/data/models/static/document_status_model.g.dart b/lib/data/models/static/document_status_model.g.dart new file mode 100644 index 000000000..6360b66f3 --- /dev/null +++ b/lib/data/models/static/document_status_model.g.dart @@ -0,0 +1,166 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'document_status_model.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +Serializer _$documentStatusEntitySerializer = + new _$DocumentStatusEntitySerializer(); + +class _$DocumentStatusEntitySerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + DocumentStatusEntity, + _$DocumentStatusEntity + ]; + @override + final String wireName = 'DocumentStatusEntity'; + + @override + Iterable serialize( + Serializers serializers, DocumentStatusEntity object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'id', + serializers.serialize(object.id, specifiedType: const FullType(String)), + 'name', + serializers.serialize(object.name, specifiedType: const FullType(String)), + ]; + + return result; + } + + @override + DocumentStatusEntity deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new DocumentStatusEntityBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object value = iterator.current; + switch (key) { + case 'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case 'name': + result.name = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + + return result.build(); + } +} + +class _$DocumentStatusEntity extends DocumentStatusEntity { + @override + final String id; + @override + final String name; + + factory _$DocumentStatusEntity( + [void Function(DocumentStatusEntityBuilder) updates]) => + (new DocumentStatusEntityBuilder()..update(updates))._build(); + + _$DocumentStatusEntity._({this.id, this.name}) : super._() { + BuiltValueNullFieldError.checkNotNull(id, r'DocumentStatusEntity', 'id'); + BuiltValueNullFieldError.checkNotNull( + name, r'DocumentStatusEntity', 'name'); + } + + @override + DocumentStatusEntity rebuild( + void Function(DocumentStatusEntityBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + DocumentStatusEntityBuilder toBuilder() => + new DocumentStatusEntityBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is DocumentStatusEntity && + id == other.id && + name == other.name; + } + + int __hashCode; + @override + int get hashCode { + if (__hashCode != null) return __hashCode; + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return __hashCode ??= _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'DocumentStatusEntity') + ..add('id', id) + ..add('name', name)) + .toString(); + } +} + +class DocumentStatusEntityBuilder + implements Builder { + _$DocumentStatusEntity _$v; + + String _id; + String get id => _$this._id; + set id(String id) => _$this._id = id; + + String _name; + String get name => _$this._name; + set name(String name) => _$this._name = name; + + DocumentStatusEntityBuilder(); + + DocumentStatusEntityBuilder get _$this { + final $v = _$v; + if ($v != null) { + _id = $v.id; + _name = $v.name; + _$v = null; + } + return this; + } + + @override + void replace(DocumentStatusEntity other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$DocumentStatusEntity; + } + + @override + void update(void Function(DocumentStatusEntityBuilder) updates) { + if (updates != null) updates(this); + } + + @override + DocumentStatusEntity build() => _build(); + + _$DocumentStatusEntity _build() { + final _$result = _$v ?? + new _$DocumentStatusEntity._( + id: BuiltValueNullFieldError.checkNotNull( + id, r'DocumentStatusEntity', 'id'), + name: BuiltValueNullFieldError.checkNotNull( + name, r'DocumentStatusEntity', 'name')); + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint