part of 'generated.dart';

class UpdateWorkforceVariablesBuilder {
  String id;
  Optional<String> _workforceNumber = Optional.optional(nativeFromJson, nativeToJson);
  Optional<WorkforceEmploymentType> _employmentType = Optional.optional((data) => WorkforceEmploymentType.values.byName(data), enumSerializer);
  Optional<WorkforceStatus> _status = Optional.optional((data) => WorkforceStatus.values.byName(data), enumSerializer);

  final FirebaseDataConnect _dataConnect;  UpdateWorkforceVariablesBuilder workforceNumber(String? t) {
   _workforceNumber.value = t;
   return this;
  }
  UpdateWorkforceVariablesBuilder employmentType(WorkforceEmploymentType? t) {
   _employmentType.value = t;
   return this;
  }
  UpdateWorkforceVariablesBuilder status(WorkforceStatus? t) {
   _status.value = t;
   return this;
  }

  UpdateWorkforceVariablesBuilder(this._dataConnect, {required  this.id,});
  Deserializer<UpdateWorkforceData> dataDeserializer = (dynamic json)  => UpdateWorkforceData.fromJson(jsonDecode(json));
  Serializer<UpdateWorkforceVariables> varsSerializer = (UpdateWorkforceVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<UpdateWorkforceData, UpdateWorkforceVariables>> execute() {
    return ref().execute();
  }

  MutationRef<UpdateWorkforceData, UpdateWorkforceVariables> ref() {
    UpdateWorkforceVariables vars= UpdateWorkforceVariables(id: id,workforceNumber: _workforceNumber,employmentType: _employmentType,status: _status,);
    return _dataConnect.mutation("updateWorkforce", dataDeserializer, varsSerializer, vars);
  }
}

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

    final UpdateWorkforceWorkforceUpdate otherTyped = other as UpdateWorkforceWorkforceUpdate;
    return id == otherTyped.id;
    
  }
  @override
  int get hashCode => id.hashCode;
  

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

  UpdateWorkforceWorkforceUpdate({
    required this.id,
  });
}

@immutable
class UpdateWorkforceData {
  final UpdateWorkforceWorkforceUpdate? workforce_update;
  UpdateWorkforceData.fromJson(dynamic json):
  
  workforce_update = json['workforce_update'] == null ? null : UpdateWorkforceWorkforceUpdate.fromJson(json['workforce_update']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateWorkforceData otherTyped = other as UpdateWorkforceData;
    return workforce_update == otherTyped.workforce_update;
    
  }
  @override
  int get hashCode => workforce_update.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if (workforce_update != null) {
      json['workforce_update'] = workforce_update!.toJson();
    }
    return json;
  }

  UpdateWorkforceData({
    this.workforce_update,
  });
}

@immutable
class UpdateWorkforceVariables {
  final String id;
  late final Optional<String>workforceNumber;
  late final Optional<WorkforceEmploymentType>employmentType;
  late final Optional<WorkforceStatus>status;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  UpdateWorkforceVariables.fromJson(Map<String, dynamic> json):
  
  id = nativeFromJson<String>(json['id']) {
  
  
  
    workforceNumber = Optional.optional(nativeFromJson, nativeToJson);
    workforceNumber.value = json['workforceNumber'] == null ? null : nativeFromJson<String>(json['workforceNumber']);
  
  
    employmentType = Optional.optional((data) => WorkforceEmploymentType.values.byName(data), enumSerializer);
    employmentType.value = json['employmentType'] == null ? null : WorkforceEmploymentType.values.byName(json['employmentType']);
  
  
    status = Optional.optional((data) => WorkforceStatus.values.byName(data), enumSerializer);
    status.value = json['status'] == null ? null : WorkforceStatus.values.byName(json['status']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

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

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    if(workforceNumber.state == OptionalState.set) {
      json['workforceNumber'] = workforceNumber.toJson();
    }
    if(employmentType.state == OptionalState.set) {
      json['employmentType'] = employmentType.toJson();
    }
    if(status.state == OptionalState.set) {
      json['status'] = status.toJson();
    }
    return json;
  }

  UpdateWorkforceVariables({
    required this.id,
    required this.workforceNumber,
    required this.employmentType,
    required this.status,
  });
}

