part of 'generated.dart';

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

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

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

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

@immutable
class ListWorkforceByStaffIdWorkforces {
  final String id;
  final String vendorId;
  final String workforceNumber;
  final EnumValue<WorkforceEmploymentType>? employmentType;
  final EnumValue<WorkforceStatus>? status;
  final Timestamp? createdAt;
  final Timestamp? updatedAt;
  final ListWorkforceByStaffIdWorkforcesVendor vendor;
  ListWorkforceByStaffIdWorkforces.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  vendorId = nativeFromJson<String>(json['vendorId']),
  workforceNumber = nativeFromJson<String>(json['workforceNumber']),
  employmentType = json['employmentType'] == null ? null : workforceEmploymentTypeDeserializer(json['employmentType']),
  status = json['status'] == null ? null : workforceStatusDeserializer(json['status']),
  createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
  updatedAt = json['updatedAt'] == null ? null : Timestamp.fromJson(json['updatedAt']),
  vendor = ListWorkforceByStaffIdWorkforcesVendor.fromJson(json['vendor']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListWorkforceByStaffIdWorkforces otherTyped = other as ListWorkforceByStaffIdWorkforces;
    return id == otherTyped.id && 
    vendorId == otherTyped.vendorId && 
    workforceNumber == otherTyped.workforceNumber && 
    employmentType == otherTyped.employmentType && 
    status == otherTyped.status && 
    createdAt == otherTyped.createdAt && 
    updatedAt == otherTyped.updatedAt && 
    vendor == otherTyped.vendor;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, vendorId.hashCode, workforceNumber.hashCode, employmentType.hashCode, status.hashCode, createdAt.hashCode, updatedAt.hashCode, vendor.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['vendorId'] = nativeToJson<String>(vendorId);
    json['workforceNumber'] = nativeToJson<String>(workforceNumber);
    if (employmentType != null) {
      json['employmentType'] = 
    workforceEmploymentTypeSerializer(employmentType!)
    ;
    }
    if (status != null) {
      json['status'] = 
    workforceStatusSerializer(status!)
    ;
    }
    if (createdAt != null) {
      json['createdAt'] = createdAt!.toJson();
    }
    if (updatedAt != null) {
      json['updatedAt'] = updatedAt!.toJson();
    }
    json['vendor'] = vendor.toJson();
    return json;
  }

  ListWorkforceByStaffIdWorkforces({
    required this.id,
    required this.vendorId,
    required this.workforceNumber,
    this.employmentType,
    this.status,
    this.createdAt,
    this.updatedAt,
    required this.vendor,
  });
}

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

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

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

  ListWorkforceByStaffIdWorkforcesVendor({
    required this.id,
    required this.companyName,
  });
}

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

    final ListWorkforceByStaffIdData otherTyped = other as ListWorkforceByStaffIdData;
    return workforces == otherTyped.workforces;
    
  }
  @override
  int get hashCode => workforces.hashCode;
  

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

  ListWorkforceByStaffIdData({
    required this.workforces,
  });
}

@immutable
class ListWorkforceByStaffIdVariables {
  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.')
  ListWorkforceByStaffIdVariables.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 ListWorkforceByStaffIdVariables otherTyped = other as ListWorkforceByStaffIdVariables;
    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;
  }

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

