part of 'generated.dart';

class CreateCertificateVariablesBuilder {
  String name;
  Optional<String> _description = Optional.optional(nativeFromJson, nativeToJson);
  Optional<Timestamp> _expiry = Optional.optional((json) => json['expiry'] = Timestamp.fromJson(json['expiry']), defaultSerializer);
  CertificateStatus status;
  Optional<String> _fileUrl = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _icon = Optional.optional(nativeFromJson, nativeToJson);
  Optional<ComplianceType> _certificationType = Optional.optional((data) => ComplianceType.values.byName(data), enumSerializer);
  Optional<String> _issuer = Optional.optional(nativeFromJson, nativeToJson);
  String staffId;
  Optional<ValidationStatus> _validationStatus = Optional.optional((data) => ValidationStatus.values.byName(data), enumSerializer);
  Optional<String> _certificateNumber = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  CreateCertificateVariablesBuilder description(String? t) {
   _description.value = t;
   return this;
  }
  CreateCertificateVariablesBuilder expiry(Timestamp? t) {
   _expiry.value = t;
   return this;
  }
  CreateCertificateVariablesBuilder fileUrl(String? t) {
   _fileUrl.value = t;
   return this;
  }
  CreateCertificateVariablesBuilder icon(String? t) {
   _icon.value = t;
   return this;
  }
  CreateCertificateVariablesBuilder certificationType(ComplianceType? t) {
   _certificationType.value = t;
   return this;
  }
  CreateCertificateVariablesBuilder issuer(String? t) {
   _issuer.value = t;
   return this;
  }
  CreateCertificateVariablesBuilder validationStatus(ValidationStatus? t) {
   _validationStatus.value = t;
   return this;
  }
  CreateCertificateVariablesBuilder certificateNumber(String? t) {
   _certificateNumber.value = t;
   return this;
  }

  CreateCertificateVariablesBuilder(this._dataConnect, {required  this.name,required  this.status,required  this.staffId,});
  Deserializer<CreateCertificateData> dataDeserializer = (dynamic json)  => CreateCertificateData.fromJson(jsonDecode(json));
  Serializer<CreateCertificateVariables> varsSerializer = (CreateCertificateVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateCertificateData, CreateCertificateVariables>> execute() {
    return ref().execute();
  }

  MutationRef<CreateCertificateData, CreateCertificateVariables> ref() {
    CreateCertificateVariables vars= CreateCertificateVariables(name: name,description: _description,expiry: _expiry,status: status,fileUrl: _fileUrl,icon: _icon,certificationType: _certificationType,issuer: _issuer,staffId: staffId,validationStatus: _validationStatus,certificateNumber: _certificateNumber,);
    return _dataConnect.mutation("CreateCertificate", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final CreateCertificateData otherTyped = other as CreateCertificateData;
    return certificate_insert == otherTyped.certificate_insert;
    
  }
  @override
  int get hashCode => certificate_insert.hashCode;
  

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

  CreateCertificateData({
    required this.certificate_insert,
  });
}

@immutable
class CreateCertificateVariables {
  final String name;
  late final Optional<String>description;
  late final Optional<Timestamp>expiry;
  final CertificateStatus status;
  late final Optional<String>fileUrl;
  late final Optional<String>icon;
  late final Optional<ComplianceType>certificationType;
  late final Optional<String>issuer;
  final String staffId;
  late final Optional<ValidationStatus>validationStatus;
  late final Optional<String>certificateNumber;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  CreateCertificateVariables.fromJson(Map<String, dynamic> json):
  
  name = nativeFromJson<String>(json['name']),
  status = CertificateStatus.values.byName(json['status']),
  staffId = nativeFromJson<String>(json['staffId']) {
  
  
  
    description = Optional.optional(nativeFromJson, nativeToJson);
    description.value = json['description'] == null ? null : nativeFromJson<String>(json['description']);
  
  
    expiry = Optional.optional((json) => json['expiry'] = Timestamp.fromJson(json['expiry']), defaultSerializer);
    expiry.value = json['expiry'] == null ? null : Timestamp.fromJson(json['expiry']);
  
  
  
    fileUrl = Optional.optional(nativeFromJson, nativeToJson);
    fileUrl.value = json['fileUrl'] == null ? null : nativeFromJson<String>(json['fileUrl']);
  
  
    icon = Optional.optional(nativeFromJson, nativeToJson);
    icon.value = json['icon'] == null ? null : nativeFromJson<String>(json['icon']);
  
  
    certificationType = Optional.optional((data) => ComplianceType.values.byName(data), enumSerializer);
    certificationType.value = json['certificationType'] == null ? null : ComplianceType.values.byName(json['certificationType']);
  
  
    issuer = Optional.optional(nativeFromJson, nativeToJson);
    issuer.value = json['issuer'] == null ? null : nativeFromJson<String>(json['issuer']);
  
  
  
    validationStatus = Optional.optional((data) => ValidationStatus.values.byName(data), enumSerializer);
    validationStatus.value = json['validationStatus'] == null ? null : ValidationStatus.values.byName(json['validationStatus']);
  
  
    certificateNumber = Optional.optional(nativeFromJson, nativeToJson);
    certificateNumber.value = json['certificateNumber'] == null ? null : nativeFromJson<String>(json['certificateNumber']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final CreateCertificateVariables otherTyped = other as CreateCertificateVariables;
    return name == otherTyped.name && 
    description == otherTyped.description && 
    expiry == otherTyped.expiry && 
    status == otherTyped.status && 
    fileUrl == otherTyped.fileUrl && 
    icon == otherTyped.icon && 
    certificationType == otherTyped.certificationType && 
    issuer == otherTyped.issuer && 
    staffId == otherTyped.staffId && 
    validationStatus == otherTyped.validationStatus && 
    certificateNumber == otherTyped.certificateNumber;
    
  }
  @override
  int get hashCode => Object.hashAll([name.hashCode, description.hashCode, expiry.hashCode, status.hashCode, fileUrl.hashCode, icon.hashCode, certificationType.hashCode, issuer.hashCode, staffId.hashCode, validationStatus.hashCode, certificateNumber.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['name'] = nativeToJson<String>(name);
    if(description.state == OptionalState.set) {
      json['description'] = description.toJson();
    }
    if(expiry.state == OptionalState.set) {
      json['expiry'] = expiry.toJson();
    }
    json['status'] = 
    status.name
    ;
    if(fileUrl.state == OptionalState.set) {
      json['fileUrl'] = fileUrl.toJson();
    }
    if(icon.state == OptionalState.set) {
      json['icon'] = icon.toJson();
    }
    if(certificationType.state == OptionalState.set) {
      json['certificationType'] = certificationType.toJson();
    }
    if(issuer.state == OptionalState.set) {
      json['issuer'] = issuer.toJson();
    }
    json['staffId'] = nativeToJson<String>(staffId);
    if(validationStatus.state == OptionalState.set) {
      json['validationStatus'] = validationStatus.toJson();
    }
    if(certificateNumber.state == OptionalState.set) {
      json['certificateNumber'] = certificateNumber.toJson();
    }
    return json;
  }

  CreateCertificateVariables({
    required this.name,
    required this.description,
    required this.expiry,
    required this.status,
    required this.fileUrl,
    required this.icon,
    required this.certificationType,
    required this.issuer,
    required this.staffId,
    required this.validationStatus,
    required this.certificateNumber,
  });
}

