part of 'generated.dart';

class UpdateRoleVariablesBuilder {
  String id;
  Optional<String> _name = Optional.optional(nativeFromJson, nativeToJson);
  Optional<double> _costPerHour = Optional.optional(nativeFromJson, nativeToJson);
  String roleCategoryId;

  final FirebaseDataConnect _dataConnect;  UpdateRoleVariablesBuilder name(String? t) {
   _name.value = t;
   return this;
  }
  UpdateRoleVariablesBuilder costPerHour(double? t) {
   _costPerHour.value = t;
   return this;
  }

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

  MutationRef<UpdateRoleData, UpdateRoleVariables> ref() {
    UpdateRoleVariables vars= UpdateRoleVariables(id: id,name: _name,costPerHour: _costPerHour,roleCategoryId: roleCategoryId,);
    return _dataConnect.mutation("updateRole", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class UpdateRoleRoleUpdate {
  final String id;
  UpdateRoleRoleUpdate.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 UpdateRoleRoleUpdate otherTyped = other as UpdateRoleRoleUpdate;
    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;
  }

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

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

    final UpdateRoleData otherTyped = other as UpdateRoleData;
    return role_update == otherTyped.role_update;
    
  }
  @override
  int get hashCode => role_update.hashCode;
  

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

  UpdateRoleData({
    this.role_update,
  });
}

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

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

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

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

