// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'approval_requirement.dart';

// **************************************************************************
// _IsarCollectionGenerator
// **************************************************************************

// coverage:ignore-file
// ignore_for_file: duplicate_ignore, invalid_use_of_protected_member, lines_longer_than_80_chars, constant_identifier_names, avoid_js_rounded_ints, no_leading_underscores_for_local_identifiers, require_trailing_commas, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_in_if_null_operators, library_private_types_in_public_api, prefer_const_constructors
// ignore_for_file: type=lint

extension GetApprovalRequirementCollection on Isar {
  IsarCollection<int, ApprovalRequirement> get approvalRequirements =>
      this.collection();
}

const ApprovalRequirementSchema = IsarGeneratedSchema(
  schema: IsarSchema(
    name: 'ApprovalRequirement',
    idName: 'id',
    embedded: false,
    properties: [
      IsarPropertySchema(
        name: 'name',
        type: IsarType.string,
      ),
      IsarPropertySchema(
        name: 'notes',
        type: IsarType.string,
      ),
      IsarPropertySchema(
        name: 'measures',
        type: IsarType.objectList,
        target: 'IdValue',
      ),
      IsarPropertySchema(
        name: 'authority',
        type: IsarType.objectList,
        target: 'IdValueColor',
      ),
      IsarPropertySchema(
        name: 'typeOfApproval',
        type: IsarType.objectList,
        target: 'IdValueColor',
      ),
    ],
    indexes: [
      IsarIndexSchema(
        name: 'name',
        properties: [
          "name",
        ],
        unique: false,
        hash: false,
      ),
    ],
  ),
  converter: IsarObjectConverter<int, ApprovalRequirement>(
    serialize: serializeApprovalRequirement,
    deserialize: deserializeApprovalRequirement,
    deserializeProperty: deserializeApprovalRequirementProp,
  ),
  embeddedSchemas: [IdValueSchema, IdValueColorSchema],
);

@isarProtected
int serializeApprovalRequirement(
    IsarWriter writer, ApprovalRequirement object) {
  {
    final value = object.name;
    if (value == null) {
      IsarCore.writeNull(writer, 1);
    } else {
      IsarCore.writeString(writer, 1, value);
    }
  }
  {
    final value = object.notes;
    if (value == null) {
      IsarCore.writeNull(writer, 2);
    } else {
      IsarCore.writeString(writer, 2, value);
    }
  }
  {
    final list = object.measures;
    if (list == null) {
      IsarCore.writeNull(writer, 3);
    } else {
      final listWriter = IsarCore.beginList(writer, 3, list.length);
      for (var i = 0; i < list.length; i++) {
        {
          final value = list[i];
          final objectWriter = IsarCore.beginObject(listWriter, i);
          serializeIdValue(objectWriter, value);
          IsarCore.endObject(listWriter, objectWriter);
        }
      }
      IsarCore.endList(writer, listWriter);
    }
  }
  {
    final list = object.authority;
    if (list == null) {
      IsarCore.writeNull(writer, 4);
    } else {
      final listWriter = IsarCore.beginList(writer, 4, list.length);
      for (var i = 0; i < list.length; i++) {
        {
          final value = list[i];
          final objectWriter = IsarCore.beginObject(listWriter, i);
          serializeIdValueColor(objectWriter, value);
          IsarCore.endObject(listWriter, objectWriter);
        }
      }
      IsarCore.endList(writer, listWriter);
    }
  }
  {
    final list = object.typeOfApproval;
    if (list == null) {
      IsarCore.writeNull(writer, 5);
    } else {
      final listWriter = IsarCore.beginList(writer, 5, list.length);
      for (var i = 0; i < list.length; i++) {
        {
          final value = list[i];
          final objectWriter = IsarCore.beginObject(listWriter, i);
          serializeIdValueColor(objectWriter, value);
          IsarCore.endObject(listWriter, objectWriter);
        }
      }
      IsarCore.endList(writer, listWriter);
    }
  }
  return object.id;
}

@isarProtected
ApprovalRequirement deserializeApprovalRequirement(IsarReader reader) {
  final object = ApprovalRequirement();
  object.name = IsarCore.readString(reader, 1);
  object.notes = IsarCore.readString(reader, 2);
  {
    final length = IsarCore.readList(reader, 3, IsarCore.readerPtrPtr);
    {
      final reader = IsarCore.readerPtr;
      if (reader.isNull) {
        object.measures = null;
      } else {
        final list = List<IdValue>.filled(length, IdValue(), growable: true);
        for (var i = 0; i < length; i++) {
          {
            final objectReader = IsarCore.readObject(reader, i);
            if (objectReader.isNull) {
              list[i] = IdValue();
            } else {
              final embedded = deserializeIdValue(objectReader);
              IsarCore.freeReader(objectReader);
              list[i] = embedded;
            }
          }
        }
        IsarCore.freeReader(reader);
        object.measures = list;
      }
    }
  }
  {
    final length = IsarCore.readList(reader, 4, IsarCore.readerPtrPtr);
    {
      final reader = IsarCore.readerPtr;
      if (reader.isNull) {
        object.authority = null;
      } else {
        final list =
            List<IdValueColor>.filled(length, IdValueColor(), growable: true);
        for (var i = 0; i < length; i++) {
          {
            final objectReader = IsarCore.readObject(reader, i);
            if (objectReader.isNull) {
              list[i] = IdValueColor();
            } else {
              final embedded = deserializeIdValueColor(objectReader);
              IsarCore.freeReader(objectReader);
              list[i] = embedded;
            }
          }
        }
        IsarCore.freeReader(reader);
        object.authority = list;
      }
    }
  }
  {
    final length = IsarCore.readList(reader, 5, IsarCore.readerPtrPtr);
    {
      final reader = IsarCore.readerPtr;
      if (reader.isNull) {
        object.typeOfApproval = null;
      } else {
        final list =
            List<IdValueColor>.filled(length, IdValueColor(), growable: true);
        for (var i = 0; i < length; i++) {
          {
            final objectReader = IsarCore.readObject(reader, i);
            if (objectReader.isNull) {
              list[i] = IdValueColor();
            } else {
              final embedded = deserializeIdValueColor(objectReader);
              IsarCore.freeReader(objectReader);
              list[i] = embedded;
            }
          }
        }
        IsarCore.freeReader(reader);
        object.typeOfApproval = list;
      }
    }
  }
  object.id = IsarCore.readId(reader);
  return object;
}

@isarProtected
dynamic deserializeApprovalRequirementProp(IsarReader reader, int property) {
  switch (property) {
    case 1:
      return IsarCore.readString(reader, 1);
    case 2:
      return IsarCore.readString(reader, 2);
    case 3:
      {
        final length = IsarCore.readList(reader, 3, IsarCore.readerPtrPtr);
        {
          final reader = IsarCore.readerPtr;
          if (reader.isNull) {
            return null;
          } else {
            final list =
                List<IdValue>.filled(length, IdValue(), growable: true);
            for (var i = 0; i < length; i++) {
              {
                final objectReader = IsarCore.readObject(reader, i);
                if (objectReader.isNull) {
                  list[i] = IdValue();
                } else {
                  final embedded = deserializeIdValue(objectReader);
                  IsarCore.freeReader(objectReader);
                  list[i] = embedded;
                }
              }
            }
            IsarCore.freeReader(reader);
            return list;
          }
        }
      }
    case 4:
      {
        final length = IsarCore.readList(reader, 4, IsarCore.readerPtrPtr);
        {
          final reader = IsarCore.readerPtr;
          if (reader.isNull) {
            return null;
          } else {
            final list = List<IdValueColor>.filled(length, IdValueColor(),
                growable: true);
            for (var i = 0; i < length; i++) {
              {
                final objectReader = IsarCore.readObject(reader, i);
                if (objectReader.isNull) {
                  list[i] = IdValueColor();
                } else {
                  final embedded = deserializeIdValueColor(objectReader);
                  IsarCore.freeReader(objectReader);
                  list[i] = embedded;
                }
              }
            }
            IsarCore.freeReader(reader);
            return list;
          }
        }
      }
    case 5:
      {
        final length = IsarCore.readList(reader, 5, IsarCore.readerPtrPtr);
        {
          final reader = IsarCore.readerPtr;
          if (reader.isNull) {
            return null;
          } else {
            final list = List<IdValueColor>.filled(length, IdValueColor(),
                growable: true);
            for (var i = 0; i < length; i++) {
              {
                final objectReader = IsarCore.readObject(reader, i);
                if (objectReader.isNull) {
                  list[i] = IdValueColor();
                } else {
                  final embedded = deserializeIdValueColor(objectReader);
                  IsarCore.freeReader(objectReader);
                  list[i] = embedded;
                }
              }
            }
            IsarCore.freeReader(reader);
            return list;
          }
        }
      }
    case 0:
      return IsarCore.readId(reader);
    default:
      throw ArgumentError('Unknown property: $property');
  }
}

sealed class _ApprovalRequirementUpdate {
  bool call({
    required int id,
    String? name,
    String? notes,
  });
}

class _ApprovalRequirementUpdateImpl implements _ApprovalRequirementUpdate {
  const _ApprovalRequirementUpdateImpl(this.collection);

  final IsarCollection<int, ApprovalRequirement> collection;

  @override
  bool call({
    required int id,
    Object? name = ignore,
    Object? notes = ignore,
  }) {
    return collection.updateProperties([
          id
        ], {
          if (name != ignore) 1: name as String?,
          if (notes != ignore) 2: notes as String?,
        }) >
        0;
  }
}

sealed class _ApprovalRequirementUpdateAll {
  int call({
    required List<int> id,
    String? name,
    String? notes,
  });
}

class _ApprovalRequirementUpdateAllImpl
    implements _ApprovalRequirementUpdateAll {
  const _ApprovalRequirementUpdateAllImpl(this.collection);

  final IsarCollection<int, ApprovalRequirement> collection;

  @override
  int call({
    required List<int> id,
    Object? name = ignore,
    Object? notes = ignore,
  }) {
    return collection.updateProperties(id, {
      if (name != ignore) 1: name as String?,
      if (notes != ignore) 2: notes as String?,
    });
  }
}

extension ApprovalRequirementUpdate
    on IsarCollection<int, ApprovalRequirement> {
  _ApprovalRequirementUpdate get update => _ApprovalRequirementUpdateImpl(this);

  _ApprovalRequirementUpdateAll get updateAll =>
      _ApprovalRequirementUpdateAllImpl(this);
}

sealed class _ApprovalRequirementQueryUpdate {
  int call({
    String? name,
    String? notes,
  });
}

class _ApprovalRequirementQueryUpdateImpl
    implements _ApprovalRequirementQueryUpdate {
  const _ApprovalRequirementQueryUpdateImpl(this.query, {this.limit});

  final IsarQuery<ApprovalRequirement> query;
  final int? limit;

  @override
  int call({
    Object? name = ignore,
    Object? notes = ignore,
  }) {
    return query.updateProperties(limit: limit, {
      if (name != ignore) 1: name as String?,
      if (notes != ignore) 2: notes as String?,
    });
  }
}

extension ApprovalRequirementQueryUpdate on IsarQuery<ApprovalRequirement> {
  _ApprovalRequirementQueryUpdate get updateFirst =>
      _ApprovalRequirementQueryUpdateImpl(this, limit: 1);

  _ApprovalRequirementQueryUpdate get updateAll =>
      _ApprovalRequirementQueryUpdateImpl(this);
}

class _ApprovalRequirementQueryBuilderUpdateImpl
    implements _ApprovalRequirementQueryUpdate {
  const _ApprovalRequirementQueryBuilderUpdateImpl(this.query, {this.limit});

  final QueryBuilder<ApprovalRequirement, ApprovalRequirement, QOperations>
      query;
  final int? limit;

  @override
  int call({
    Object? name = ignore,
    Object? notes = ignore,
  }) {
    final q = query.build();
    try {
      return q.updateProperties(limit: limit, {
        if (name != ignore) 1: name as String?,
        if (notes != ignore) 2: notes as String?,
      });
    } finally {
      q.close();
    }
  }
}

extension ApprovalRequirementQueryBuilderUpdate
    on QueryBuilder<ApprovalRequirement, ApprovalRequirement, QOperations> {
  _ApprovalRequirementQueryUpdate get updateFirst =>
      _ApprovalRequirementQueryBuilderUpdateImpl(this, limit: 1);

  _ApprovalRequirementQueryUpdate get updateAll =>
      _ApprovalRequirementQueryBuilderUpdateImpl(this);
}

extension ApprovalRequirementQueryFilter on QueryBuilder<ApprovalRequirement,
    ApprovalRequirement, QFilterCondition> {
  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameIsNull() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(const IsNullCondition(property: 1));
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameIsNotNull() {
    return QueryBuilder.apply(not(), (query) {
      return query.addFilterCondition(const IsNullCondition(property: 1));
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameEqualTo(
    String? value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        EqualCondition(
          property: 1,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameGreaterThan(
    String? value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        GreaterCondition(
          property: 1,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameGreaterThanOrEqualTo(
    String? value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        GreaterOrEqualCondition(
          property: 1,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameLessThan(
    String? value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        LessCondition(
          property: 1,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameLessThanOrEqualTo(
    String? value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        LessOrEqualCondition(
          property: 1,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameBetween(
    String? lower,
    String? upper, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        BetweenCondition(
          property: 1,
          lower: lower,
          upper: upper,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameStartsWith(
    String value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        StartsWithCondition(
          property: 1,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameEndsWith(
    String value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        EndsWithCondition(
          property: 1,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameContains(String value, {bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        ContainsCondition(
          property: 1,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameMatches(String pattern, {bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        MatchesCondition(
          property: 1,
          wildcard: pattern,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameIsEmpty() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        const EqualCondition(
          property: 1,
          value: '',
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      nameIsNotEmpty() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        const GreaterCondition(
          property: 1,
          value: '',
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesIsNull() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(const IsNullCondition(property: 2));
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesIsNotNull() {
    return QueryBuilder.apply(not(), (query) {
      return query.addFilterCondition(const IsNullCondition(property: 2));
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesEqualTo(
    String? value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        EqualCondition(
          property: 2,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesGreaterThan(
    String? value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        GreaterCondition(
          property: 2,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesGreaterThanOrEqualTo(
    String? value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        GreaterOrEqualCondition(
          property: 2,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesLessThan(
    String? value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        LessCondition(
          property: 2,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesLessThanOrEqualTo(
    String? value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        LessOrEqualCondition(
          property: 2,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesBetween(
    String? lower,
    String? upper, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        BetweenCondition(
          property: 2,
          lower: lower,
          upper: upper,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesStartsWith(
    String value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        StartsWithCondition(
          property: 2,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesEndsWith(
    String value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        EndsWithCondition(
          property: 2,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesContains(String value, {bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        ContainsCondition(
          property: 2,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesMatches(String pattern, {bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        MatchesCondition(
          property: 2,
          wildcard: pattern,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesIsEmpty() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        const EqualCondition(
          property: 2,
          value: '',
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      notesIsNotEmpty() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        const GreaterCondition(
          property: 2,
          value: '',
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      measuresIsNull() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(const IsNullCondition(property: 3));
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      measuresIsNotNull() {
    return QueryBuilder.apply(not(), (query) {
      return query.addFilterCondition(const IsNullCondition(property: 3));
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      measuresIsEmpty() {
    return not().group(
      (q) => q.measuresIsNull().or().measuresIsNotEmpty(),
    );
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      measuresIsNotEmpty() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        const GreaterOrEqualCondition(property: 3, value: null),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      authorityIsNull() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(const IsNullCondition(property: 4));
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      authorityIsNotNull() {
    return QueryBuilder.apply(not(), (query) {
      return query.addFilterCondition(const IsNullCondition(property: 4));
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      authorityIsEmpty() {
    return not().group(
      (q) => q.authorityIsNull().or().authorityIsNotEmpty(),
    );
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      authorityIsNotEmpty() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        const GreaterOrEqualCondition(property: 4, value: null),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      typeOfApprovalIsNull() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(const IsNullCondition(property: 5));
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      typeOfApprovalIsNotNull() {
    return QueryBuilder.apply(not(), (query) {
      return query.addFilterCondition(const IsNullCondition(property: 5));
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      typeOfApprovalIsEmpty() {
    return not().group(
      (q) => q.typeOfApprovalIsNull().or().typeOfApprovalIsNotEmpty(),
    );
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      typeOfApprovalIsNotEmpty() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        const GreaterOrEqualCondition(property: 5, value: null),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      idEqualTo(
    int value,
  ) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        EqualCondition(
          property: 0,
          value: value,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      idGreaterThan(
    int value,
  ) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        GreaterCondition(
          property: 0,
          value: value,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      idGreaterThanOrEqualTo(
    int value,
  ) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        GreaterOrEqualCondition(
          property: 0,
          value: value,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      idLessThan(
    int value,
  ) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        LessCondition(
          property: 0,
          value: value,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      idLessThanOrEqualTo(
    int value,
  ) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        LessOrEqualCondition(
          property: 0,
          value: value,
        ),
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterFilterCondition>
      idBetween(
    int lower,
    int upper,
  ) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        BetweenCondition(
          property: 0,
          lower: lower,
          upper: upper,
        ),
      );
    });
  }
}

extension ApprovalRequirementQueryObject on QueryBuilder<ApprovalRequirement,
    ApprovalRequirement, QFilterCondition> {}

extension ApprovalRequirementQuerySortBy
    on QueryBuilder<ApprovalRequirement, ApprovalRequirement, QSortBy> {
  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      sortByName({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(
        1,
        caseSensitive: caseSensitive,
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      sortByNameDesc({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(
        1,
        sort: Sort.desc,
        caseSensitive: caseSensitive,
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      sortByNotes({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(
        2,
        caseSensitive: caseSensitive,
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      sortByNotesDesc({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(
        2,
        sort: Sort.desc,
        caseSensitive: caseSensitive,
      );
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      sortById() {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(0);
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      sortByIdDesc() {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(0, sort: Sort.desc);
    });
  }
}

extension ApprovalRequirementQuerySortThenBy
    on QueryBuilder<ApprovalRequirement, ApprovalRequirement, QSortThenBy> {
  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      thenByName({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(1, caseSensitive: caseSensitive);
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      thenByNameDesc({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(1, sort: Sort.desc, caseSensitive: caseSensitive);
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      thenByNotes({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(2, caseSensitive: caseSensitive);
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      thenByNotesDesc({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(2, sort: Sort.desc, caseSensitive: caseSensitive);
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      thenById() {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(0);
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterSortBy>
      thenByIdDesc() {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(0, sort: Sort.desc);
    });
  }
}

extension ApprovalRequirementQueryWhereDistinct
    on QueryBuilder<ApprovalRequirement, ApprovalRequirement, QDistinct> {
  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterDistinct>
      distinctByName({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addDistinctBy(1, caseSensitive: caseSensitive);
    });
  }

  QueryBuilder<ApprovalRequirement, ApprovalRequirement, QAfterDistinct>
      distinctByNotes({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addDistinctBy(2, caseSensitive: caseSensitive);
    });
  }
}

extension ApprovalRequirementQueryProperty1
    on QueryBuilder<ApprovalRequirement, ApprovalRequirement, QProperty> {
  QueryBuilder<ApprovalRequirement, String?, QAfterProperty> nameProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(1);
    });
  }

  QueryBuilder<ApprovalRequirement, String?, QAfterProperty> notesProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(2);
    });
  }

  QueryBuilder<ApprovalRequirement, List<IdValue>?, QAfterProperty>
      measuresProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(3);
    });
  }

  QueryBuilder<ApprovalRequirement, List<IdValueColor>?, QAfterProperty>
      authorityProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(4);
    });
  }

  QueryBuilder<ApprovalRequirement, List<IdValueColor>?, QAfterProperty>
      typeOfApprovalProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(5);
    });
  }

  QueryBuilder<ApprovalRequirement, int, QAfterProperty> idProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(0);
    });
  }
}

extension ApprovalRequirementQueryProperty2<R>
    on QueryBuilder<ApprovalRequirement, R, QAfterProperty> {
  QueryBuilder<ApprovalRequirement, (R, String?), QAfterProperty>
      nameProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(1);
    });
  }

  QueryBuilder<ApprovalRequirement, (R, String?), QAfterProperty>
      notesProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(2);
    });
  }

  QueryBuilder<ApprovalRequirement, (R, List<IdValue>?), QAfterProperty>
      measuresProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(3);
    });
  }

  QueryBuilder<ApprovalRequirement, (R, List<IdValueColor>?), QAfterProperty>
      authorityProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(4);
    });
  }

  QueryBuilder<ApprovalRequirement, (R, List<IdValueColor>?), QAfterProperty>
      typeOfApprovalProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(5);
    });
  }

  QueryBuilder<ApprovalRequirement, (R, int), QAfterProperty> idProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(0);
    });
  }
}

extension ApprovalRequirementQueryProperty3<R1, R2>
    on QueryBuilder<ApprovalRequirement, (R1, R2), QAfterProperty> {
  QueryBuilder<ApprovalRequirement, (R1, R2, String?), QOperations>
      nameProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(1);
    });
  }

  QueryBuilder<ApprovalRequirement, (R1, R2, String?), QOperations>
      notesProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(2);
    });
  }

  QueryBuilder<ApprovalRequirement, (R1, R2, List<IdValue>?), QOperations>
      measuresProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(3);
    });
  }

  QueryBuilder<ApprovalRequirement, (R1, R2, List<IdValueColor>?), QOperations>
      authorityProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(4);
    });
  }

  QueryBuilder<ApprovalRequirement, (R1, R2, List<IdValueColor>?), QOperations>
      typeOfApprovalProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(5);
    });
  }

  QueryBuilder<ApprovalRequirement, (R1, R2, int), QOperations> idProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(0);
    });
  }
}

// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************

ApprovalRequirement _$ApprovalRequirementFromJson(Map<String, dynamic> json) =>
    ApprovalRequirement()
      ..id = (json['id'] as num).toInt()
      ..name = json['Name der Genehmigung'] as String?
      ..notes = json['Anmerkungen'] as String?
      ..measures = (json['Maßnahme'] as List<dynamic>?)
          ?.map((e) => IdValue.fromJson(e as Map<String, dynamic>))
          .toList()
      ..authority = (json['Behörde'] as List<dynamic>?)
          ?.map((e) => IdValueColor.fromJson(e as Map<String, dynamic>))
          .toList()
      ..typeOfApproval = (json['Art der Genehmigung'] as List<dynamic>?)
          ?.map((e) => IdValueColor.fromJson(e as Map<String, dynamic>))
          .toList();

Map<String, dynamic> _$ApprovalRequirementToJson(
        ApprovalRequirement instance) =>
    <String, dynamic>{
      'id': instance.id,
      'Name der Genehmigung': instance.name,
      'Anmerkungen': instance.notes,
      'Maßnahme': instance.measures?.map((e) => e.toJson()).toList(),
      'Behörde': instance.authority?.map((e) => e.toJson()).toList(),
      'Art der Genehmigung':
          instance.typeOfApproval?.map((e) => e.toJson()).toList(),
    };
