// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'measure_grouping.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 GetMeasureGroupingCollection on Isar {
  IsarCollection<int, MeasureGrouping> get measureGroupings =>
      this.collection();
}

const MeasureGroupingSchema = IsarGeneratedSchema(
  schema: IsarSchema(
    name: 'MeasureGrouping',
    idName: 'id',
    embedded: false,
    properties: [
      IsarPropertySchema(
        name: 'name',
        type: IsarType.string,
      ),
      IsarPropertySchema(
        name: 'categories',
        type: IsarType.objectList,
        target: 'IdValueColor',
      ),
      IsarPropertySchema(
        name: 'type',
        type: IsarType.object,
        target: 'IdValueColor',
      ),
      IsarPropertySchema(
        name: 'files',
        type: IsarType.objectList,
        target: 'FilePart',
      ),
      IsarPropertySchema(
        name: 'description',
        type: IsarType.string,
      ),
      IsarPropertySchema(
        name: 'subtype',
        type: IsarType.objectList,
        target: 'IdValue',
      ),
    ],
    indexes: [
      IsarIndexSchema(
        name: 'name',
        properties: [
          "name",
        ],
        unique: false,
        hash: false,
      ),
    ],
  ),
  converter: IsarObjectConverter<int, MeasureGrouping>(
    serialize: serializeMeasureGrouping,
    deserialize: deserializeMeasureGrouping,
    deserializeProperty: deserializeMeasureGroupingProp,
  ),
  embeddedSchemas: [
    IdValueColorSchema,
    FilePartSchema,
    ThumbnailsSchema,
    ThumbnailSchema,
    IdValueSchema
  ],
);

@isarProtected
int serializeMeasureGrouping(IsarWriter writer, MeasureGrouping object) {
  {
    final value = object.name;
    if (value == null) {
      IsarCore.writeNull(writer, 1);
    } else {
      IsarCore.writeString(writer, 1, value);
    }
  }
  {
    final list = object.categories;
    if (list == null) {
      IsarCore.writeNull(writer, 2);
    } else {
      final listWriter = IsarCore.beginList(writer, 2, 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 value = object.type;
    if (value == null) {
      IsarCore.writeNull(writer, 3);
    } else {
      final objectWriter = IsarCore.beginObject(writer, 3);
      serializeIdValueColor(objectWriter, value);
      IsarCore.endObject(writer, objectWriter);
    }
  }
  {
    final list = object.files;
    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);
          serializeFilePart(objectWriter, value);
          IsarCore.endObject(listWriter, objectWriter);
        }
      }
      IsarCore.endList(writer, listWriter);
    }
  }
  {
    final value = object.description;
    if (value == null) {
      IsarCore.writeNull(writer, 5);
    } else {
      IsarCore.writeString(writer, 5, value);
    }
  }
  {
    final list = object.subtype;
    if (list == null) {
      IsarCore.writeNull(writer, 6);
    } else {
      final listWriter = IsarCore.beginList(writer, 6, 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);
    }
  }
  return object.id;
}

@isarProtected
MeasureGrouping deserializeMeasureGrouping(IsarReader reader) {
  final object = MeasureGrouping();
  object.name = IsarCore.readString(reader, 1);
  {
    final length = IsarCore.readList(reader, 2, IsarCore.readerPtrPtr);
    {
      final reader = IsarCore.readerPtr;
      if (reader.isNull) {
        object.categories = 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.categories = list;
      }
    }
  }
  {
    final objectReader = IsarCore.readObject(reader, 3);
    if (objectReader.isNull) {
      object.type = null;
    } else {
      final embedded = deserializeIdValueColor(objectReader);
      IsarCore.freeReader(objectReader);
      object.type = embedded;
    }
  }
  {
    final length = IsarCore.readList(reader, 4, IsarCore.readerPtrPtr);
    {
      final reader = IsarCore.readerPtr;
      if (reader.isNull) {
        object.files = null;
      } else {
        final list = List<FilePart>.filled(length, FilePart(), growable: true);
        for (var i = 0; i < length; i++) {
          {
            final objectReader = IsarCore.readObject(reader, i);
            if (objectReader.isNull) {
              list[i] = FilePart();
            } else {
              final embedded = deserializeFilePart(objectReader);
              IsarCore.freeReader(objectReader);
              list[i] = embedded;
            }
          }
        }
        IsarCore.freeReader(reader);
        object.files = list;
      }
    }
  }
  object.description = IsarCore.readString(reader, 5);
  {
    final length = IsarCore.readList(reader, 6, IsarCore.readerPtrPtr);
    {
      final reader = IsarCore.readerPtr;
      if (reader.isNull) {
        object.subtype = 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.subtype = list;
      }
    }
  }
  object.id = IsarCore.readId(reader);
  return object;
}

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

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

class _MeasureGroupingUpdateImpl implements _MeasureGroupingUpdate {
  const _MeasureGroupingUpdateImpl(this.collection);

  final IsarCollection<int, MeasureGrouping> collection;

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

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

class _MeasureGroupingUpdateAllImpl implements _MeasureGroupingUpdateAll {
  const _MeasureGroupingUpdateAllImpl(this.collection);

  final IsarCollection<int, MeasureGrouping> collection;

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

extension MeasureGroupingUpdate on IsarCollection<int, MeasureGrouping> {
  _MeasureGroupingUpdate get update => _MeasureGroupingUpdateImpl(this);

  _MeasureGroupingUpdateAll get updateAll =>
      _MeasureGroupingUpdateAllImpl(this);
}

sealed class _MeasureGroupingQueryUpdate {
  int call({
    String? name,
    String? description,
  });
}

class _MeasureGroupingQueryUpdateImpl implements _MeasureGroupingQueryUpdate {
  const _MeasureGroupingQueryUpdateImpl(this.query, {this.limit});

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

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

extension MeasureGroupingQueryUpdate on IsarQuery<MeasureGrouping> {
  _MeasureGroupingQueryUpdate get updateFirst =>
      _MeasureGroupingQueryUpdateImpl(this, limit: 1);

  _MeasureGroupingQueryUpdate get updateAll =>
      _MeasureGroupingQueryUpdateImpl(this);
}

class _MeasureGroupingQueryBuilderUpdateImpl
    implements _MeasureGroupingQueryUpdate {
  const _MeasureGroupingQueryBuilderUpdateImpl(this.query, {this.limit});

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

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

extension MeasureGroupingQueryBuilderUpdate
    on QueryBuilder<MeasureGrouping, MeasureGrouping, QOperations> {
  _MeasureGroupingQueryUpdate get updateFirst =>
      _MeasureGroupingQueryBuilderUpdateImpl(this, limit: 1);

  _MeasureGroupingQueryUpdate get updateAll =>
      _MeasureGroupingQueryBuilderUpdateImpl(this);
}

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

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

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

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

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

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

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

  QueryBuilder<MeasureGrouping, MeasureGrouping, 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<MeasureGrouping, MeasureGrouping, QAfterFilterCondition>
      nameStartsWith(
    String value, {
    bool caseSensitive = true,
  }) {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        StartsWithCondition(
          property: 1,
          value: value,
          caseSensitive: caseSensitive,
        ),
      );
    });
  }

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

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

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

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

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

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

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

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterFilterCondition>
      categoriesIsEmpty() {
    return not().group(
      (q) => q.categoriesIsNull().or().categoriesIsNotEmpty(),
    );
  }

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterFilterCondition>
      categoriesIsNotEmpty() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        const GreaterOrEqualCondition(property: 2, value: null),
      );
    });
  }

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

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

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

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

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterFilterCondition>
      filesIsEmpty() {
    return not().group(
      (q) => q.filesIsNull().or().filesIsNotEmpty(),
    );
  }

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

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

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

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

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

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

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

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

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

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

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

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

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

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterFilterCondition>
      descriptionIsEmpty() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        const EqualCondition(
          property: 5,
          value: '',
        ),
      );
    });
  }

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterFilterCondition>
      descriptionIsNotEmpty() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        const GreaterCondition(
          property: 5,
          value: '',
        ),
      );
    });
  }

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterFilterCondition>
      subtypeIsNull() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(const IsNullCondition(property: 6));
    });
  }

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterFilterCondition>
      subtypeIsNotNull() {
    return QueryBuilder.apply(not(), (query) {
      return query.addFilterCondition(const IsNullCondition(property: 6));
    });
  }

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterFilterCondition>
      subtypeIsEmpty() {
    return not().group(
      (q) => q.subtypeIsNull().or().subtypeIsNotEmpty(),
    );
  }

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterFilterCondition>
      subtypeIsNotEmpty() {
    return QueryBuilder.apply(this, (query) {
      return query.addFilterCondition(
        const GreaterOrEqualCondition(property: 6, value: null),
      );
    });
  }

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

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

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

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

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

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

extension MeasureGroupingQueryObject
    on QueryBuilder<MeasureGrouping, MeasureGrouping, QFilterCondition> {
  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterFilterCondition> type(
      FilterQuery<IdValueColor> q) {
    return QueryBuilder.apply(this, (query) {
      return query.object(q, 3);
    });
  }
}

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

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

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterSortBy>
      sortByDescription({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(
        5,
        caseSensitive: caseSensitive,
      );
    });
  }

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

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

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

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

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

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterSortBy>
      thenByDescription({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addSortBy(5, caseSensitive: caseSensitive);
    });
  }

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

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

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

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

  QueryBuilder<MeasureGrouping, MeasureGrouping, QAfterDistinct>
      distinctByDescription({bool caseSensitive = true}) {
    return QueryBuilder.apply(this, (query) {
      return query.addDistinctBy(5, caseSensitive: caseSensitive);
    });
  }
}

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

  QueryBuilder<MeasureGrouping, List<IdValueColor>?, QAfterProperty>
      categoriesProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(2);
    });
  }

  QueryBuilder<MeasureGrouping, IdValueColor?, QAfterProperty> typeProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(3);
    });
  }

  QueryBuilder<MeasureGrouping, List<FilePart>?, QAfterProperty>
      filesProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(4);
    });
  }

  QueryBuilder<MeasureGrouping, String?, QAfterProperty> descriptionProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(5);
    });
  }

  QueryBuilder<MeasureGrouping, List<IdValue>?, QAfterProperty>
      subtypeProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(6);
    });
  }

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

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

  QueryBuilder<MeasureGrouping, (R, List<IdValueColor>?), QAfterProperty>
      categoriesProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(2);
    });
  }

  QueryBuilder<MeasureGrouping, (R, IdValueColor?), QAfterProperty>
      typeProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(3);
    });
  }

  QueryBuilder<MeasureGrouping, (R, List<FilePart>?), QAfterProperty>
      filesProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(4);
    });
  }

  QueryBuilder<MeasureGrouping, (R, String?), QAfterProperty>
      descriptionProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(5);
    });
  }

  QueryBuilder<MeasureGrouping, (R, List<IdValue>?), QAfterProperty>
      subtypeProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(6);
    });
  }

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

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

  QueryBuilder<MeasureGrouping, (R1, R2, List<IdValueColor>?), QOperations>
      categoriesProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(2);
    });
  }

  QueryBuilder<MeasureGrouping, (R1, R2, IdValueColor?), QOperations>
      typeProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(3);
    });
  }

  QueryBuilder<MeasureGrouping, (R1, R2, List<FilePart>?), QOperations>
      filesProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(4);
    });
  }

  QueryBuilder<MeasureGrouping, (R1, R2, String?), QOperations>
      descriptionProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(5);
    });
  }

  QueryBuilder<MeasureGrouping, (R1, R2, List<IdValue>?), QOperations>
      subtypeProperty() {
    return QueryBuilder.apply(this, (query) {
      return query.addProperty(6);
    });
  }

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

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

MeasureGrouping _$MeasureGroupingFromJson(Map<String, dynamic> json) =>
    MeasureGrouping()
      ..id = (json['id'] as num).toInt()
      ..name = json['Maßnahmentyp'] as String?
      ..categories = (json['Flächentyp Factsheet'] as List<dynamic>?)
          ?.map((e) => IdValueColor.fromJson(e as Map<String, dynamic>))
          .toList()
      ..type = json['Maßnahmengruppe'] == null
          ? null
          : IdValueColor.fromJson(
              json['Maßnahmengruppe'] as Map<String, dynamic>)
      ..files = (json['Datei'] as List<dynamic>?)
          ?.map((e) => FilePart.fromJson(e as Map<String, dynamic>))
          .toList()
      ..description = json['Definition Factsheet'] as String?
      ..subtype = (json['Factsheet_Status'] as List<dynamic>?)
          ?.map((e) => IdValue.fromJson(e as Map<String, dynamic>))
          .toList();

Map<String, dynamic> _$MeasureGroupingToJson(MeasureGrouping instance) =>
    <String, dynamic>{
      'id': instance.id,
      'Maßnahmentyp': instance.name,
      'Flächentyp Factsheet':
          instance.categories?.map((e) => e.toJson()).toList(),
      'Maßnahmengruppe': instance.type?.toJson(),
      'Datei': instance.files?.map((e) => e.toJson()).toList(),
      'Definition Factsheet': instance.description,
      'Factsheet_Status': instance.subtype?.map((e) => e.toJson()).toList(),
    };
