part of 'generated.dart';

class CreateApplicationVariablesBuilder {
  String shiftId;
  String staffId;
  ApplicationStatus status;
  Optional<Timestamp> _checkInTime = Optional.optional((json) => json['checkInTime'] = Timestamp.fromJson(json['checkInTime']), defaultSerializer);
  Optional<Timestamp> _checkOutTime = Optional.optional((json) => json['checkOutTime'] = Timestamp.fromJson(json['checkOutTime']), defaultSerializer);
  ApplicationOrigin origin;
  String roleId;

  final FirebaseDataConnect _dataConnect;  CreateApplicationVariablesBuilder checkInTime(Timestamp? t) {
   _checkInTime.value = t;
   return this;
  }
  CreateApplicationVariablesBuilder checkOutTime(Timestamp? t) {
   _checkOutTime.value = t;
   return this;
  }

  CreateApplicationVariablesBuilder(this._dataConnect, {required  this.shiftId,required  this.staffId,required  this.status,required  this.origin,required  this.roleId,});
  Deserializer<CreateApplicationData> dataDeserializer = (dynamic json)  => CreateApplicationData.fromJson(jsonDecode(json));
  Serializer<CreateApplicationVariables> varsSerializer = (CreateApplicationVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateApplicationData, CreateApplicationVariables>> execute() {
    return ref().execute();
  }

  MutationRef<CreateApplicationData, CreateApplicationVariables> ref() {
    CreateApplicationVariables vars= CreateApplicationVariables(shiftId: shiftId,staffId: staffId,status: status,checkInTime: _checkInTime,checkOutTime: _checkOutTime,origin: origin,roleId: roleId,);
    return _dataConnect.mutation("createApplication", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final CreateApplicationData otherTyped = other as CreateApplicationData;
    return application_insert == otherTyped.application_insert;
    
  }
  @override
  int get hashCode => application_insert.hashCode;
  

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

  CreateApplicationData({
    required this.application_insert,
  });
}

@immutable
class CreateApplicationVariables {
  final String shiftId;
  final String staffId;
  final ApplicationStatus status;
  late final Optional<Timestamp>checkInTime;
  late final Optional<Timestamp>checkOutTime;
  final ApplicationOrigin origin;
  final String roleId;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  CreateApplicationVariables.fromJson(Map<String, dynamic> json):
  
  shiftId = nativeFromJson<String>(json['shiftId']),
  staffId = nativeFromJson<String>(json['staffId']),
  status = ApplicationStatus.values.byName(json['status']),
  origin = ApplicationOrigin.values.byName(json['origin']),
  roleId = nativeFromJson<String>(json['roleId']) {
  
  
  
  
  
    checkInTime = Optional.optional((json) => json['checkInTime'] = Timestamp.fromJson(json['checkInTime']), defaultSerializer);
    checkInTime.value = json['checkInTime'] == null ? null : Timestamp.fromJson(json['checkInTime']);
  
  
    checkOutTime = Optional.optional((json) => json['checkOutTime'] = Timestamp.fromJson(json['checkOutTime']), defaultSerializer);
    checkOutTime.value = json['checkOutTime'] == null ? null : Timestamp.fromJson(json['checkOutTime']);
  
  
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final CreateApplicationVariables otherTyped = other as CreateApplicationVariables;
    return shiftId == otherTyped.shiftId && 
    staffId == otherTyped.staffId && 
    status == otherTyped.status && 
    checkInTime == otherTyped.checkInTime && 
    checkOutTime == otherTyped.checkOutTime && 
    origin == otherTyped.origin && 
    roleId == otherTyped.roleId;
    
  }
  @override
  int get hashCode => Object.hashAll([shiftId.hashCode, staffId.hashCode, status.hashCode, checkInTime.hashCode, checkOutTime.hashCode, origin.hashCode, roleId.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['shiftId'] = nativeToJson<String>(shiftId);
    json['staffId'] = nativeToJson<String>(staffId);
    json['status'] = 
    status.name
    ;
    if(checkInTime.state == OptionalState.set) {
      json['checkInTime'] = checkInTime.toJson();
    }
    if(checkOutTime.state == OptionalState.set) {
      json['checkOutTime'] = checkOutTime.toJson();
    }
    json['origin'] = 
    origin.name
    ;
    json['roleId'] = nativeToJson<String>(roleId);
    return json;
  }

  CreateApplicationVariables({
    required this.shiftId,
    required this.staffId,
    required this.status,
    required this.checkInTime,
    required this.checkOutTime,
    required this.origin,
    required this.roleId,
  });
}

