part of 'generated.dart';

class UpdateEmergencyContactVariablesBuilder {
  String id;
  Optional<String> _name = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _phone = Optional.optional(nativeFromJson, nativeToJson);
  Optional<RelationshipType> _relationship = Optional.optional((data) => RelationshipType.values.byName(data), enumSerializer);

  final FirebaseDataConnect _dataConnect;  UpdateEmergencyContactVariablesBuilder name(String? t) {
   _name.value = t;
   return this;
  }
  UpdateEmergencyContactVariablesBuilder phone(String? t) {
   _phone.value = t;
   return this;
  }
  UpdateEmergencyContactVariablesBuilder relationship(RelationshipType? t) {
   _relationship.value = t;
   return this;
  }

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

  MutationRef<UpdateEmergencyContactData, UpdateEmergencyContactVariables> ref() {
    UpdateEmergencyContactVariables vars= UpdateEmergencyContactVariables(id: id,name: _name,phone: _phone,relationship: _relationship,);
    return _dataConnect.mutation("updateEmergencyContact", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final UpdateEmergencyContactData otherTyped = other as UpdateEmergencyContactData;
    return emergencyContact_update == otherTyped.emergencyContact_update;
    
  }
  @override
  int get hashCode => emergencyContact_update.hashCode;
  

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

  UpdateEmergencyContactData({
    this.emergencyContact_update,
  });
}

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

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

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

  UpdateEmergencyContactVariables({
    required this.id,
    required this.name,
    required this.phone,
    required this.relationship,
  });
}

