part of 'generated.dart';

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

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

  ListStaffRolesByStaffIdVariablesBuilder(this._dataConnect, {required  this.staffId,});
  Deserializer<ListStaffRolesByStaffIdData> dataDeserializer = (dynamic json)  => ListStaffRolesByStaffIdData.fromJson(jsonDecode(json));
  Serializer<ListStaffRolesByStaffIdVariables> varsSerializer = (ListStaffRolesByStaffIdVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<ListStaffRolesByStaffIdData, ListStaffRolesByStaffIdVariables>> execute() {
    return ref().execute();
  }

  QueryRef<ListStaffRolesByStaffIdData, ListStaffRolesByStaffIdVariables> ref() {
    ListStaffRolesByStaffIdVariables vars= ListStaffRolesByStaffIdVariables(staffId: staffId,offset: _offset,limit: _limit,);
    return _dataConnect.query("listStaffRolesByStaffId", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class ListStaffRolesByStaffIdStaffRoles {
  final String id;
  final String staffId;
  final String roleId;
  final Timestamp? createdAt;
  final EnumValue<RoleType>? roleType;
  final ListStaffRolesByStaffIdStaffRolesRole role;
  ListStaffRolesByStaffIdStaffRoles.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']),
  role = ListStaffRolesByStaffIdStaffRolesRole.fromJson(json['role']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListStaffRolesByStaffIdStaffRoles otherTyped = other as ListStaffRolesByStaffIdStaffRoles;
    return id == otherTyped.id && 
    staffId == otherTyped.staffId && 
    roleId == otherTyped.roleId && 
    createdAt == otherTyped.createdAt && 
    roleType == otherTyped.roleType && 
    role == otherTyped.role;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, staffId.hashCode, roleId.hashCode, createdAt.hashCode, roleType.hashCode, role.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['role'] = role.toJson();
    return json;
  }

  ListStaffRolesByStaffIdStaffRoles({
    required this.id,
    required this.staffId,
    required this.roleId,
    this.createdAt,
    this.roleType,
    required this.role,
  });
}

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

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

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

  ListStaffRolesByStaffIdStaffRolesRole({
    required this.id,
    required this.name,
    required this.costPerHour,
  });
}

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

    final ListStaffRolesByStaffIdData otherTyped = other as ListStaffRolesByStaffIdData;
    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;
  }

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

@immutable
class ListStaffRolesByStaffIdVariables {
  final String staffId;
  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.')
  ListStaffRolesByStaffIdVariables.fromJson(Map<String, dynamic> json):
  
  staffId = nativeFromJson<String>(json['staffId']) {
  
  
  
    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 ListStaffRolesByStaffIdVariables otherTyped = other as ListStaffRolesByStaffIdVariables;
    return staffId == otherTyped.staffId && 
    offset == otherTyped.offset && 
    limit == otherTyped.limit;
    
  }
  @override
  int get hashCode => Object.hashAll([staffId.hashCode, offset.hashCode, limit.hashCode]);
  

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

  ListStaffRolesByStaffIdVariables({
    required this.staffId,
    required this.offset,
    required this.limit,
  });
}

