part of 'generated.dart';

class ListEmergencyContactsVariablesBuilder {
  
  final FirebaseDataConnect _dataConnect;
  ListEmergencyContactsVariablesBuilder(this._dataConnect, );
  Deserializer<ListEmergencyContactsData> dataDeserializer = (dynamic json)  => ListEmergencyContactsData.fromJson(jsonDecode(json));
  
  Future<QueryResult<ListEmergencyContactsData, void>> execute() {
    return ref().execute();
  }

  QueryRef<ListEmergencyContactsData, void> ref() {
    
    return _dataConnect.query("listEmergencyContacts", dataDeserializer, emptySerializer, null);
  }
}

@immutable
class ListEmergencyContactsEmergencyContacts {
  final String id;
  final String name;
  final String phone;
  final EnumValue<RelationshipType> relationship;
  final String staffId;
  final Timestamp? createdAt;
  final Timestamp? updatedAt;
  final String? createdBy;
  ListEmergencyContactsEmergencyContacts.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  name = nativeFromJson<String>(json['name']),
  phone = nativeFromJson<String>(json['phone']),
  relationship = relationshipTypeDeserializer(json['relationship']),
  staffId = nativeFromJson<String>(json['staffId']),
  createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
  updatedAt = json['updatedAt'] == null ? null : Timestamp.fromJson(json['updatedAt']),
  createdBy = json['createdBy'] == null ? null : nativeFromJson<String>(json['createdBy']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

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

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['name'] = nativeToJson<String>(name);
    json['phone'] = nativeToJson<String>(phone);
    json['relationship'] = 
    relationshipTypeSerializer(relationship)
    ;
    json['staffId'] = nativeToJson<String>(staffId);
    if (createdAt != null) {
      json['createdAt'] = createdAt!.toJson();
    }
    if (updatedAt != null) {
      json['updatedAt'] = updatedAt!.toJson();
    }
    if (createdBy != null) {
      json['createdBy'] = nativeToJson<String?>(createdBy);
    }
    return json;
  }

  ListEmergencyContactsEmergencyContacts({
    required this.id,
    required this.name,
    required this.phone,
    required this.relationship,
    required this.staffId,
    this.createdAt,
    this.updatedAt,
    this.createdBy,
  });
}

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

    final ListEmergencyContactsData otherTyped = other as ListEmergencyContactsData;
    return emergencyContacts == otherTyped.emergencyContacts;
    
  }
  @override
  int get hashCode => emergencyContacts.hashCode;
  

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

  ListEmergencyContactsData({
    required this.emergencyContacts,
  });
}

