part of 'generated.dart';

class CreateDocumentVariablesBuilder {
  DocumentType documentType;
  String name;
  Optional<String> _description = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  CreateDocumentVariablesBuilder description(String? t) {
   _description.value = t;
   return this;
  }

  CreateDocumentVariablesBuilder(this._dataConnect, {required  this.documentType,required  this.name,});
  Deserializer<CreateDocumentData> dataDeserializer = (dynamic json)  => CreateDocumentData.fromJson(jsonDecode(json));
  Serializer<CreateDocumentVariables> varsSerializer = (CreateDocumentVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateDocumentData, CreateDocumentVariables>> execute() {
    return ref().execute();
  }

  MutationRef<CreateDocumentData, CreateDocumentVariables> ref() {
    CreateDocumentVariables vars= CreateDocumentVariables(documentType: documentType,name: name,description: _description,);
    return _dataConnect.mutation("createDocument", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class CreateDocumentDocumentInsert {
  final String id;
  CreateDocumentDocumentInsert.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 CreateDocumentDocumentInsert otherTyped = other as CreateDocumentDocumentInsert;
    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;
  }

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

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

    final CreateDocumentData otherTyped = other as CreateDocumentData;
    return document_insert == otherTyped.document_insert;
    
  }
  @override
  int get hashCode => document_insert.hashCode;
  

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

  CreateDocumentData({
    required this.document_insert,
  });
}

@immutable
class CreateDocumentVariables {
  final DocumentType documentType;
  final String name;
  late final Optional<String>description;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  CreateDocumentVariables.fromJson(Map<String, dynamic> json):
  
  documentType = DocumentType.values.byName(json['documentType']),
  name = 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 CreateDocumentVariables otherTyped = other as CreateDocumentVariables;
    return documentType == otherTyped.documentType && 
    name == otherTyped.name && 
    description == otherTyped.description;
    
  }
  @override
  int get hashCode => Object.hashAll([documentType.hashCode, name.hashCode, description.hashCode]);
  

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

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

