part of 'generated.dart';

class CreateClientFeedbackVariablesBuilder {
  String businessId;
  String vendorId;
  Optional<int> _rating = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _comment = Optional.optional(nativeFromJson, nativeToJson);
  Optional<Timestamp> _date = Optional.optional((json) => json['date'] = Timestamp.fromJson(json['date']), defaultSerializer);
  Optional<String> _createdBy = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  CreateClientFeedbackVariablesBuilder rating(int? t) {
   _rating.value = t;
   return this;
  }
  CreateClientFeedbackVariablesBuilder comment(String? t) {
   _comment.value = t;
   return this;
  }
  CreateClientFeedbackVariablesBuilder date(Timestamp? t) {
   _date.value = t;
   return this;
  }
  CreateClientFeedbackVariablesBuilder createdBy(String? t) {
   _createdBy.value = t;
   return this;
  }

  CreateClientFeedbackVariablesBuilder(this._dataConnect, {required  this.businessId,required  this.vendorId,});
  Deserializer<CreateClientFeedbackData> dataDeserializer = (dynamic json)  => CreateClientFeedbackData.fromJson(jsonDecode(json));
  Serializer<CreateClientFeedbackVariables> varsSerializer = (CreateClientFeedbackVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateClientFeedbackData, CreateClientFeedbackVariables>> execute() {
    return ref().execute();
  }

  MutationRef<CreateClientFeedbackData, CreateClientFeedbackVariables> ref() {
    CreateClientFeedbackVariables vars= CreateClientFeedbackVariables(businessId: businessId,vendorId: vendorId,rating: _rating,comment: _comment,date: _date,createdBy: _createdBy,);
    return _dataConnect.mutation("createClientFeedback", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final CreateClientFeedbackData otherTyped = other as CreateClientFeedbackData;
    return clientFeedback_insert == otherTyped.clientFeedback_insert;
    
  }
  @override
  int get hashCode => clientFeedback_insert.hashCode;
  

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

  CreateClientFeedbackData({
    required this.clientFeedback_insert,
  });
}

@immutable
class CreateClientFeedbackVariables {
  final String businessId;
  final String vendorId;
  late final Optional<int>rating;
  late final Optional<String>comment;
  late final Optional<Timestamp>date;
  late final Optional<String>createdBy;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  CreateClientFeedbackVariables.fromJson(Map<String, dynamic> json):
  
  businessId = nativeFromJson<String>(json['businessId']),
  vendorId = nativeFromJson<String>(json['vendorId']) {
  
  
  
  
    rating = Optional.optional(nativeFromJson, nativeToJson);
    rating.value = json['rating'] == null ? null : nativeFromJson<int>(json['rating']);
  
  
    comment = Optional.optional(nativeFromJson, nativeToJson);
    comment.value = json['comment'] == null ? null : nativeFromJson<String>(json['comment']);
  
  
    date = Optional.optional((json) => json['date'] = Timestamp.fromJson(json['date']), defaultSerializer);
    date.value = json['date'] == null ? null : Timestamp.fromJson(json['date']);
  
  
    createdBy = Optional.optional(nativeFromJson, nativeToJson);
    createdBy.value = json['createdBy'] == null ? null : nativeFromJson<String>(json['createdBy']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final CreateClientFeedbackVariables otherTyped = other as CreateClientFeedbackVariables;
    return businessId == otherTyped.businessId && 
    vendorId == otherTyped.vendorId && 
    rating == otherTyped.rating && 
    comment == otherTyped.comment && 
    date == otherTyped.date && 
    createdBy == otherTyped.createdBy;
    
  }
  @override
  int get hashCode => Object.hashAll([businessId.hashCode, vendorId.hashCode, rating.hashCode, comment.hashCode, date.hashCode, createdBy.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['businessId'] = nativeToJson<String>(businessId);
    json['vendorId'] = nativeToJson<String>(vendorId);
    if(rating.state == OptionalState.set) {
      json['rating'] = rating.toJson();
    }
    if(comment.state == OptionalState.set) {
      json['comment'] = comment.toJson();
    }
    if(date.state == OptionalState.set) {
      json['date'] = date.toJson();
    }
    if(createdBy.state == OptionalState.set) {
      json['createdBy'] = createdBy.toJson();
    }
    return json;
  }

  CreateClientFeedbackVariables({
    required this.businessId,
    required this.vendorId,
    required this.rating,
    required this.comment,
    required this.date,
    required this.createdBy,
  });
}

