part of 'generated.dart';

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

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

  ListWorkforceByVendorIdVariablesBuilder(this._dataConnect, {required  this.vendorId,});
  Deserializer<ListWorkforceByVendorIdData> dataDeserializer = (dynamic json)  => ListWorkforceByVendorIdData.fromJson(jsonDecode(json));
  Serializer<ListWorkforceByVendorIdVariables> varsSerializer = (ListWorkforceByVendorIdVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<ListWorkforceByVendorIdData, ListWorkforceByVendorIdVariables>> execute() {
    return ref().execute();
  }

  QueryRef<ListWorkforceByVendorIdData, ListWorkforceByVendorIdVariables> ref() {
    ListWorkforceByVendorIdVariables vars= ListWorkforceByVendorIdVariables(vendorId: vendorId,offset: _offset,limit: _limit,);
    return _dataConnect.query("listWorkforceByVendorId", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class ListWorkforceByVendorIdWorkforces {
  final String id;
  final String staffId;
  final String workforceNumber;
  final EnumValue<WorkforceEmploymentType>? employmentType;
  final EnumValue<WorkforceStatus>? status;
  final Timestamp? createdAt;
  final ListWorkforceByVendorIdWorkforcesStaff staff;
  ListWorkforceByVendorIdWorkforces.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  staffId = nativeFromJson<String>(json['staffId']),
  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']),
  staff = ListWorkforceByVendorIdWorkforcesStaff.fromJson(json['staff']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

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

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['staffId'] = nativeToJson<String>(staffId);
    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();
    }
    json['staff'] = staff.toJson();
    return json;
  }

  ListWorkforceByVendorIdWorkforces({
    required this.id,
    required this.staffId,
    required this.workforceNumber,
    this.employmentType,
    this.status,
    this.createdAt,
    required this.staff,
  });
}

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

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

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

  ListWorkforceByVendorIdWorkforcesStaff({
    required this.id,
    required this.fullName,
  });
}

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

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

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

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

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

  ListWorkforceByVendorIdVariables({
    required this.vendorId,
    required this.offset,
    required this.limit,
  });
}

