part of 'generated.dart';

class UpdateDocumentVariablesBuilder {
  String id;
  Optional<DocumentType> _documentType = Optional.optional((data) => DocumentType.values.byName(data), enumSerializer);
  Optional<String> _name = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _description = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  UpdateDocumentVariablesBuilder documentType(DocumentType? t) {
   _documentType.value = t;
   return this;
  }
  UpdateDocumentVariablesBuilder name(String? t) {
   _name.value = t;
   return this;
  }
  UpdateDocumentVariablesBuilder description(String? t) {
   _description.value = t;
   return this;
  }

  UpdateDocumentVariablesBuilder(this._dataConnect, {required  this.id,});
  Deserializer<UpdateDocumentData> dataDeserializer = (dynamic json)  => UpdateDocumentData.fromJson(jsonDecode(json));
  Serializer<UpdateDocumentVariables> varsSerializer = (UpdateDocumentVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<UpdateDocumentData, UpdateDocumentVariables>> execute() {
    return ref().execute();
  }

  MutationRef<UpdateDocumentData, UpdateDocumentVariables> ref() {
    UpdateDocumentVariables vars= UpdateDocumentVariables(id: id,documentType: _documentType,name: _name,description: _description,);
    return _dataConnect.mutation("updateDocument", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class UpdateDocumentDocumentUpdate {
  final String id;
  UpdateDocumentDocumentUpdate.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateDocumentDocumentUpdate otherTyped = other as UpdateDocumentDocumentUpdate;
    return id == otherTyped.id;
    
  }
  @override
  int get hashCode => id.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    return json;
  }

  UpdateDocumentDocumentUpdate({
    required this.id,
  });
}

@immutable
class UpdateDocumentData {
  final UpdateDocumentDocumentUpdate? document_update;
  UpdateDocumentData.fromJson(dynamic json):
  
  document_update = json['document_update'] == null ? null : UpdateDocumentDocumentUpdate.fromJson(json['document_update']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateDocumentData otherTyped = other as UpdateDocumentData;
    return document_update == otherTyped.document_update;
    
  }
  @override
  int get hashCode => document_update.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if (document_update != null) {
      json['document_update'] = document_update!.toJson();
    }
    return json;
  }

  UpdateDocumentData({
    this.document_update,
  });
}

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

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

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

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

