part of 'generated.dart';

class FilterDocumentsVariablesBuilder {
  Optional<DocumentType> _documentType = Optional.optional((data) => DocumentType.values.byName(data), enumSerializer);

  final FirebaseDataConnect _dataConnect;
  FilterDocumentsVariablesBuilder documentType(DocumentType? t) {
   _documentType.value = t;
   return this;
  }

  FilterDocumentsVariablesBuilder(this._dataConnect, );
  Deserializer<FilterDocumentsData> dataDeserializer = (dynamic json)  => FilterDocumentsData.fromJson(jsonDecode(json));
  Serializer<FilterDocumentsVariables> varsSerializer = (FilterDocumentsVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<FilterDocumentsData, FilterDocumentsVariables>> execute() {
    return ref().execute();
  }

  QueryRef<FilterDocumentsData, FilterDocumentsVariables> ref() {
    FilterDocumentsVariables vars= FilterDocumentsVariables(documentType: _documentType,);
    return _dataConnect.query("filterDocuments", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class FilterDocumentsDocuments {
  final String id;
  final EnumValue<DocumentType> documentType;
  final String name;
  final String? description;
  final Timestamp? createdAt;
  FilterDocumentsDocuments.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  documentType = documentTypeDeserializer(json['documentType']),
  name = nativeFromJson<String>(json['name']),
  description = json['description'] == null ? null : nativeFromJson<String>(json['description']),
  createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final FilterDocumentsDocuments otherTyped = other as FilterDocumentsDocuments;
    return id == otherTyped.id && 
    documentType == otherTyped.documentType && 
    name == otherTyped.name && 
    description == otherTyped.description && 
    createdAt == otherTyped.createdAt;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, documentType.hashCode, name.hashCode, description.hashCode, createdAt.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['documentType'] = 
    documentTypeSerializer(documentType)
    ;
    json['name'] = nativeToJson<String>(name);
    if (description != null) {
      json['description'] = nativeToJson<String?>(description);
    }
    if (createdAt != null) {
      json['createdAt'] = createdAt!.toJson();
    }
    return json;
  }

  FilterDocumentsDocuments({
    required this.id,
    required this.documentType,
    required this.name,
    this.description,
    this.createdAt,
  });
}

@immutable
class FilterDocumentsData {
  final List<FilterDocumentsDocuments> documents;
  FilterDocumentsData.fromJson(dynamic json):
  
  documents = (json['documents'] as List<dynamic>)
        .map((e) => FilterDocumentsDocuments.fromJson(e))
        .toList();
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final FilterDocumentsData otherTyped = other as FilterDocumentsData;
    return documents == otherTyped.documents;
    
  }
  @override
  int get hashCode => documents.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['documents'] = documents.map((e) => e.toJson()).toList();
    return json;
  }

  FilterDocumentsData({
    required this.documents,
  });
}

@immutable
class FilterDocumentsVariables {
  late final Optional<DocumentType>documentType;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  FilterDocumentsVariables.fromJson(Map<String, dynamic> json) {
  
  
    documentType = Optional.optional((data) => DocumentType.values.byName(data), enumSerializer);
    documentType.value = json['documentType'] == null ? null : DocumentType.values.byName(json['documentType']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final FilterDocumentsVariables otherTyped = other as FilterDocumentsVariables;
    return documentType == otherTyped.documentType;
    
  }
  @override
  int get hashCode => documentType.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if(documentType.state == OptionalState.set) {
      json['documentType'] = documentType.toJson();
    }
    return json;
  }

  FilterDocumentsVariables({
    required this.documentType,
  });
}

