part of 'generated.dart';

class ListStaffRolesByRoleIdVariablesBuilder {
  String roleId;
  Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  ListStaffRolesByRoleIdVariablesBuilder offset(int? t) {
   _offset.value = t;
   return this;
  }
  ListStaffRolesByRoleIdVariablesBuilder limit(int? t) {
   _limit.value = t;
   return this;
  }

  ListStaffRolesByRoleIdVariablesBuilder(this._dataConnect, {required  this.roleId,});
  Deserializer<ListStaffRolesByRoleIdData> dataDeserializer = (dynamic json)  => ListStaffRolesByRoleIdData.fromJson(jsonDecode(json));
  Serializer<ListStaffRolesByRoleIdVariables> varsSerializer = (ListStaffRolesByRoleIdVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<ListStaffRolesByRoleIdData, ListStaffRolesByRoleIdVariables>> execute() {
    return ref().execute();
  }

  QueryRef<ListStaffRolesByRoleIdData, ListStaffRolesByRoleIdVariables> ref() {
    ListStaffRolesByRoleIdVariables vars= ListStaffRolesByRoleIdVariables(roleId: roleId,offset: _offset,limit: _limit,);
    return _dataConnect.query("listStaffRolesByRoleId", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class ListStaffRolesByRoleIdStaffRoles {
  final String id;
  final String staffId;
  final String roleId;
  final Timestamp? createdAt;
  final EnumValue<RoleType>? roleType;
  final ListStaffRolesByRoleIdStaffRolesStaff staff;
  ListStaffRolesByRoleIdStaffRoles.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  staffId = nativeFromJson<String>(json['staffId']),
  roleId = nativeFromJson<String>(json['roleId']),
  createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
  roleType = json['roleType'] == null ? null : roleTypeDeserializer(json['roleType']),
  staff = ListStaffRolesByRoleIdStaffRolesStaff.fromJson(json['staff']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListStaffRolesByRoleIdStaffRoles otherTyped = other as ListStaffRolesByRoleIdStaffRoles;
    return id == otherTyped.id && 
    staffId == otherTyped.staffId && 
    roleId == otherTyped.roleId && 
    createdAt == otherTyped.createdAt && 
    roleType == otherTyped.roleType && 
    staff == otherTyped.staff;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, staffId.hashCode, roleId.hashCode, createdAt.hashCode, roleType.hashCode, staff.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['staffId'] = nativeToJson<String>(staffId);
    json['roleId'] = nativeToJson<String>(roleId);
    if (createdAt != null) {
      json['createdAt'] = createdAt!.toJson();
    }
    if (roleType != null) {
      json['roleType'] = 
    roleTypeSerializer(roleType!)
    ;
    }
    json['staff'] = staff.toJson();
    return json;
  }

  ListStaffRolesByRoleIdStaffRoles({
    required this.id,
    required this.staffId,
    required this.roleId,
    this.createdAt,
    this.roleType,
    required this.staff,
  });
}

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

    final ListStaffRolesByRoleIdStaffRolesStaff otherTyped = other as ListStaffRolesByRoleIdStaffRolesStaff;
    return id == otherTyped.id && 
    fullName == otherTyped.fullName && 
    userId == otherTyped.userId && 
    email == otherTyped.email && 
    phone == otherTyped.phone;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, fullName.hashCode, userId.hashCode, email.hashCode, phone.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['fullName'] = nativeToJson<String>(fullName);
    json['userId'] = nativeToJson<String>(userId);
    if (email != null) {
      json['email'] = nativeToJson<String?>(email);
    }
    if (phone != null) {
      json['phone'] = nativeToJson<String?>(phone);
    }
    return json;
  }

  ListStaffRolesByRoleIdStaffRolesStaff({
    required this.id,
    required this.fullName,
    required this.userId,
    this.email,
    this.phone,
  });
}

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

    final ListStaffRolesByRoleIdData otherTyped = other as ListStaffRolesByRoleIdData;
    return staffRoles == otherTyped.staffRoles;
    
  }
  @override
  int get hashCode => staffRoles.hashCode;
  

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

  ListStaffRolesByRoleIdData({
    required this.staffRoles,
  });
}

@immutable
class ListStaffRolesByRoleIdVariables {
  final String roleId;
  late final Optional<int>offset;
  late final Optional<int>limit;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  ListStaffRolesByRoleIdVariables.fromJson(Map<String, dynamic> json):
  
  roleId = nativeFromJson<String>(json['roleId']) {
  
  
  
    offset = Optional.optional(nativeFromJson, nativeToJson);
    offset.value = json['offset'] == null ? null : nativeFromJson<int>(json['offset']);
  
  
    limit = Optional.optional(nativeFromJson, nativeToJson);
    limit.value = json['limit'] == null ? null : nativeFromJson<int>(json['limit']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListStaffRolesByRoleIdVariables otherTyped = other as ListStaffRolesByRoleIdVariables;
    return roleId == otherTyped.roleId && 
    offset == otherTyped.offset && 
    limit == otherTyped.limit;
    
  }
  @override
  int get hashCode => Object.hashAll([roleId.hashCode, offset.hashCode, limit.hashCode]);
  

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

  ListStaffRolesByRoleIdVariables({
    required this.roleId,
    required this.offset,
    required this.limit,
  });
}

