part of 'generated.dart';

class CreateOrderVariablesBuilder {
  Optional<String> _vendorId = Optional.optional(nativeFromJson, nativeToJson);
  String businessId;
  OrderType orderType;
  Optional<String> _location = Optional.optional(nativeFromJson, nativeToJson);
  Optional<OrderStatus> _status = Optional.optional((data) => OrderStatus.values.byName(data), enumSerializer);
  Optional<Timestamp> _date = Optional.optional((json) => json['date'] = Timestamp.fromJson(json['date']), defaultSerializer);
  Optional<Timestamp> _startDate = Optional.optional((json) => json['startDate'] = Timestamp.fromJson(json['startDate']), defaultSerializer);
  Optional<Timestamp> _endDate = Optional.optional((json) => json['endDate'] = Timestamp.fromJson(json['endDate']), defaultSerializer);
  Optional<OrderDuration> _duration = Optional.optional((data) => OrderDuration.values.byName(data), enumSerializer);
  Optional<int> _lunchBreak = Optional.optional(nativeFromJson, nativeToJson);
  Optional<double> _total = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _eventName = Optional.optional(nativeFromJson, nativeToJson);
  Optional<AnyValue> _assignedStaff = Optional.optional(AnyValue.fromJson, defaultSerializer);
  Optional<AnyValue> _shifts = Optional.optional(AnyValue.fromJson, defaultSerializer);
  Optional<int> _requested = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _hub = Optional.optional(nativeFromJson, nativeToJson);
  Optional<AnyValue> _recurringDays = Optional.optional(AnyValue.fromJson, defaultSerializer);
  Optional<Timestamp> _permanentStartDate = Optional.optional((json) => json['permanentStartDate'] = Timestamp.fromJson(json['permanentStartDate']), defaultSerializer);
  Optional<AnyValue> _permanentDays = Optional.optional(AnyValue.fromJson, defaultSerializer);
  Optional<String> _notes = Optional.optional(nativeFromJson, nativeToJson);
  Optional<AnyValue> _detectedConflicts = Optional.optional(AnyValue.fromJson, defaultSerializer);
  Optional<String> _poReference = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;
  CreateOrderVariablesBuilder vendorId(String? t) {
   _vendorId.value = t;
   return this;
  }
  CreateOrderVariablesBuilder location(String? t) {
   _location.value = t;
   return this;
  }
  CreateOrderVariablesBuilder status(OrderStatus? t) {
   _status.value = t;
   return this;
  }
  CreateOrderVariablesBuilder date(Timestamp? t) {
   _date.value = t;
   return this;
  }
  CreateOrderVariablesBuilder startDate(Timestamp? t) {
   _startDate.value = t;
   return this;
  }
  CreateOrderVariablesBuilder endDate(Timestamp? t) {
   _endDate.value = t;
   return this;
  }
  CreateOrderVariablesBuilder duration(OrderDuration? t) {
   _duration.value = t;
   return this;
  }
  CreateOrderVariablesBuilder lunchBreak(int? t) {
   _lunchBreak.value = t;
   return this;
  }
  CreateOrderVariablesBuilder total(double? t) {
   _total.value = t;
   return this;
  }
  CreateOrderVariablesBuilder eventName(String? t) {
   _eventName.value = t;
   return this;
  }
  CreateOrderVariablesBuilder assignedStaff(AnyValue? t) {
   _assignedStaff.value = t;
   return this;
  }
  CreateOrderVariablesBuilder shifts(AnyValue? t) {
   _shifts.value = t;
   return this;
  }
  CreateOrderVariablesBuilder requested(int? t) {
   _requested.value = t;
   return this;
  }
  CreateOrderVariablesBuilder hub(String? t) {
   _hub.value = t;
   return this;
  }
  CreateOrderVariablesBuilder recurringDays(AnyValue? t) {
   _recurringDays.value = t;
   return this;
  }
  CreateOrderVariablesBuilder permanentStartDate(Timestamp? t) {
   _permanentStartDate.value = t;
   return this;
  }
  CreateOrderVariablesBuilder permanentDays(AnyValue? t) {
   _permanentDays.value = t;
   return this;
  }
  CreateOrderVariablesBuilder notes(String? t) {
   _notes.value = t;
   return this;
  }
  CreateOrderVariablesBuilder detectedConflicts(AnyValue? t) {
   _detectedConflicts.value = t;
   return this;
  }
  CreateOrderVariablesBuilder poReference(String? t) {
   _poReference.value = t;
   return this;
  }

  CreateOrderVariablesBuilder(this._dataConnect, {required  this.businessId,required  this.orderType,});
  Deserializer<CreateOrderData> dataDeserializer = (dynamic json)  => CreateOrderData.fromJson(jsonDecode(json));
  Serializer<CreateOrderVariables> varsSerializer = (CreateOrderVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateOrderData, CreateOrderVariables>> execute() {
    return ref().execute();
  }

  MutationRef<CreateOrderData, CreateOrderVariables> ref() {
    CreateOrderVariables vars= CreateOrderVariables(vendorId: _vendorId,businessId: businessId,orderType: orderType,location: _location,status: _status,date: _date,startDate: _startDate,endDate: _endDate,duration: _duration,lunchBreak: _lunchBreak,total: _total,eventName: _eventName,assignedStaff: _assignedStaff,shifts: _shifts,requested: _requested,hub: _hub,recurringDays: _recurringDays,permanentStartDate: _permanentStartDate,permanentDays: _permanentDays,notes: _notes,detectedConflicts: _detectedConflicts,poReference: _poReference,);
    return _dataConnect.mutation("createOrder", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final CreateOrderData otherTyped = other as CreateOrderData;
    return order_insert == otherTyped.order_insert;
    
  }
  @override
  int get hashCode => order_insert.hashCode;
  

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

  CreateOrderData({
    required this.order_insert,
  });
}

@immutable
class CreateOrderVariables {
  late final Optional<String>vendorId;
  final String businessId;
  final OrderType orderType;
  late final Optional<String>location;
  late final Optional<OrderStatus>status;
  late final Optional<Timestamp>date;
  late final Optional<Timestamp>startDate;
  late final Optional<Timestamp>endDate;
  late final Optional<OrderDuration>duration;
  late final Optional<int>lunchBreak;
  late final Optional<double>total;
  late final Optional<String>eventName;
  late final Optional<AnyValue>assignedStaff;
  late final Optional<AnyValue>shifts;
  late final Optional<int>requested;
  late final Optional<String>hub;
  late final Optional<AnyValue>recurringDays;
  late final Optional<Timestamp>permanentStartDate;
  late final Optional<AnyValue>permanentDays;
  late final Optional<String>notes;
  late final Optional<AnyValue>detectedConflicts;
  late final Optional<String>poReference;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  CreateOrderVariables.fromJson(Map<String, dynamic> json):
  
  businessId = nativeFromJson<String>(json['businessId']),
  orderType = OrderType.values.byName(json['orderType']) {
  
  
    vendorId = Optional.optional(nativeFromJson, nativeToJson);
    vendorId.value = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']);
  
  
  
  
    location = Optional.optional(nativeFromJson, nativeToJson);
    location.value = json['location'] == null ? null : nativeFromJson<String>(json['location']);
  
  
    status = Optional.optional((data) => OrderStatus.values.byName(data), enumSerializer);
    status.value = json['status'] == null ? null : OrderStatus.values.byName(json['status']);
  
  
    date = Optional.optional((json) => json['date'] = Timestamp.fromJson(json['date']), defaultSerializer);
    date.value = json['date'] == null ? null : Timestamp.fromJson(json['date']);
  
  
    startDate = Optional.optional((json) => json['startDate'] = Timestamp.fromJson(json['startDate']), defaultSerializer);
    startDate.value = json['startDate'] == null ? null : Timestamp.fromJson(json['startDate']);
  
  
    endDate = Optional.optional((json) => json['endDate'] = Timestamp.fromJson(json['endDate']), defaultSerializer);
    endDate.value = json['endDate'] == null ? null : Timestamp.fromJson(json['endDate']);
  
  
    duration = Optional.optional((data) => OrderDuration.values.byName(data), enumSerializer);
    duration.value = json['duration'] == null ? null : OrderDuration.values.byName(json['duration']);
  
  
    lunchBreak = Optional.optional(nativeFromJson, nativeToJson);
    lunchBreak.value = json['lunchBreak'] == null ? null : nativeFromJson<int>(json['lunchBreak']);
  
  
    total = Optional.optional(nativeFromJson, nativeToJson);
    total.value = json['total'] == null ? null : nativeFromJson<double>(json['total']);
  
  
    eventName = Optional.optional(nativeFromJson, nativeToJson);
    eventName.value = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']);
  
  
    assignedStaff = Optional.optional(AnyValue.fromJson, defaultSerializer);
    assignedStaff.value = json['assignedStaff'] == null ? null : AnyValue.fromJson(json['assignedStaff']);
  
  
    shifts = Optional.optional(AnyValue.fromJson, defaultSerializer);
    shifts.value = json['shifts'] == null ? null : AnyValue.fromJson(json['shifts']);
  
  
    requested = Optional.optional(nativeFromJson, nativeToJson);
    requested.value = json['requested'] == null ? null : nativeFromJson<int>(json['requested']);
  
  
    hub = Optional.optional(nativeFromJson, nativeToJson);
    hub.value = json['hub'] == null ? null : nativeFromJson<String>(json['hub']);
  
  
    recurringDays = Optional.optional(AnyValue.fromJson, defaultSerializer);
    recurringDays.value = json['recurringDays'] == null ? null : AnyValue.fromJson(json['recurringDays']);
  
  
    permanentStartDate = Optional.optional((json) => json['permanentStartDate'] = Timestamp.fromJson(json['permanentStartDate']), defaultSerializer);
    permanentStartDate.value = json['permanentStartDate'] == null ? null : Timestamp.fromJson(json['permanentStartDate']);
  
  
    permanentDays = Optional.optional(AnyValue.fromJson, defaultSerializer);
    permanentDays.value = json['permanentDays'] == null ? null : AnyValue.fromJson(json['permanentDays']);
  
  
    notes = Optional.optional(nativeFromJson, nativeToJson);
    notes.value = json['notes'] == null ? null : nativeFromJson<String>(json['notes']);
  
  
    detectedConflicts = Optional.optional(AnyValue.fromJson, defaultSerializer);
    detectedConflicts.value = json['detectedConflicts'] == null ? null : AnyValue.fromJson(json['detectedConflicts']);
  
  
    poReference = Optional.optional(nativeFromJson, nativeToJson);
    poReference.value = json['poReference'] == null ? null : nativeFromJson<String>(json['poReference']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final CreateOrderVariables otherTyped = other as CreateOrderVariables;
    return vendorId == otherTyped.vendorId && 
    businessId == otherTyped.businessId && 
    orderType == otherTyped.orderType && 
    location == otherTyped.location && 
    status == otherTyped.status && 
    date == otherTyped.date && 
    startDate == otherTyped.startDate && 
    endDate == otherTyped.endDate && 
    duration == otherTyped.duration && 
    lunchBreak == otherTyped.lunchBreak && 
    total == otherTyped.total && 
    eventName == otherTyped.eventName && 
    assignedStaff == otherTyped.assignedStaff && 
    shifts == otherTyped.shifts && 
    requested == otherTyped.requested && 
    hub == otherTyped.hub && 
    recurringDays == otherTyped.recurringDays && 
    permanentStartDate == otherTyped.permanentStartDate && 
    permanentDays == otherTyped.permanentDays && 
    notes == otherTyped.notes && 
    detectedConflicts == otherTyped.detectedConflicts && 
    poReference == otherTyped.poReference;
    
  }
  @override
  int get hashCode => Object.hashAll([vendorId.hashCode, businessId.hashCode, orderType.hashCode, location.hashCode, status.hashCode, date.hashCode, startDate.hashCode, endDate.hashCode, duration.hashCode, lunchBreak.hashCode, total.hashCode, eventName.hashCode, assignedStaff.hashCode, shifts.hashCode, requested.hashCode, hub.hashCode, recurringDays.hashCode, permanentStartDate.hashCode, permanentDays.hashCode, notes.hashCode, detectedConflicts.hashCode, poReference.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if(vendorId.state == OptionalState.set) {
      json['vendorId'] = vendorId.toJson();
    }
    json['businessId'] = nativeToJson<String>(businessId);
    json['orderType'] = 
    orderType.name
    ;
    if(location.state == OptionalState.set) {
      json['location'] = location.toJson();
    }
    if(status.state == OptionalState.set) {
      json['status'] = status.toJson();
    }
    if(date.state == OptionalState.set) {
      json['date'] = date.toJson();
    }
    if(startDate.state == OptionalState.set) {
      json['startDate'] = startDate.toJson();
    }
    if(endDate.state == OptionalState.set) {
      json['endDate'] = endDate.toJson();
    }
    if(duration.state == OptionalState.set) {
      json['duration'] = duration.toJson();
    }
    if(lunchBreak.state == OptionalState.set) {
      json['lunchBreak'] = lunchBreak.toJson();
    }
    if(total.state == OptionalState.set) {
      json['total'] = total.toJson();
    }
    if(eventName.state == OptionalState.set) {
      json['eventName'] = eventName.toJson();
    }
    if(assignedStaff.state == OptionalState.set) {
      json['assignedStaff'] = assignedStaff.toJson();
    }
    if(shifts.state == OptionalState.set) {
      json['shifts'] = shifts.toJson();
    }
    if(requested.state == OptionalState.set) {
      json['requested'] = requested.toJson();
    }
    if(hub.state == OptionalState.set) {
      json['hub'] = hub.toJson();
    }
    if(recurringDays.state == OptionalState.set) {
      json['recurringDays'] = recurringDays.toJson();
    }
    if(permanentStartDate.state == OptionalState.set) {
      json['permanentStartDate'] = permanentStartDate.toJson();
    }
    if(permanentDays.state == OptionalState.set) {
      json['permanentDays'] = permanentDays.toJson();
    }
    if(notes.state == OptionalState.set) {
      json['notes'] = notes.toJson();
    }
    if(detectedConflicts.state == OptionalState.set) {
      json['detectedConflicts'] = detectedConflicts.toJson();
    }
    if(poReference.state == OptionalState.set) {
      json['poReference'] = poReference.toJson();
    }
    return json;
  }

  CreateOrderVariables({
    required this.vendorId,
    required this.businessId,
    required this.orderType,
    required this.location,
    required this.status,
    required this.date,
    required this.startDate,
    required this.endDate,
    required this.duration,
    required this.lunchBreak,
    required this.total,
    required this.eventName,
    required this.assignedStaff,
    required this.shifts,
    required this.requested,
    required this.hub,
    required this.recurringDays,
    required this.permanentStartDate,
    required this.permanentDays,
    required this.notes,
    required this.detectedConflicts,
    required this.poReference,
  });
}

