part of 'generated.dart';

class CreateHubVariablesBuilder {
  String name;
  Optional<String> _locationName = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _address = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _nfcTagId = Optional.optional(nativeFromJson, nativeToJson);
  String ownerId;

  final FirebaseDataConnect _dataConnect;  CreateHubVariablesBuilder locationName(String? t) {
   _locationName.value = t;
   return this;
  }
  CreateHubVariablesBuilder address(String? t) {
   _address.value = t;
   return this;
  }
  CreateHubVariablesBuilder nfcTagId(String? t) {
   _nfcTagId.value = t;
   return this;
  }

  CreateHubVariablesBuilder(this._dataConnect, {required  this.name,required  this.ownerId,});
  Deserializer<CreateHubData> dataDeserializer = (dynamic json)  => CreateHubData.fromJson(jsonDecode(json));
  Serializer<CreateHubVariables> varsSerializer = (CreateHubVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateHubData, CreateHubVariables>> execute() {
    return ref().execute();
  }

  MutationRef<CreateHubData, CreateHubVariables> ref() {
    CreateHubVariables vars= CreateHubVariables(name: name,locationName: _locationName,address: _address,nfcTagId: _nfcTagId,ownerId: ownerId,);
    return _dataConnect.mutation("createHub", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final CreateHubData otherTyped = other as CreateHubData;
    return hub_insert == otherTyped.hub_insert;
    
  }
  @override
  int get hashCode => hub_insert.hashCode;
  

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

  CreateHubData({
    required this.hub_insert,
  });
}

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

    final CreateHubVariables otherTyped = other as CreateHubVariables;
    return name == otherTyped.name && 
    locationName == otherTyped.locationName && 
    address == otherTyped.address && 
    nfcTagId == otherTyped.nfcTagId && 
    ownerId == otherTyped.ownerId;
    
  }
  @override
  int get hashCode => Object.hashAll([name.hashCode, locationName.hashCode, address.hashCode, nfcTagId.hashCode, ownerId.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['name'] = nativeToJson<String>(name);
    if(locationName.state == OptionalState.set) {
      json['locationName'] = locationName.toJson();
    }
    if(address.state == OptionalState.set) {
      json['address'] = address.toJson();
    }
    if(nfcTagId.state == OptionalState.set) {
      json['nfcTagId'] = nfcTagId.toJson();
    }
    json['ownerId'] = nativeToJson<String>(ownerId);
    return json;
  }

  CreateHubVariables({
    required this.name,
    required this.locationName,
    required this.address,
    required this.nfcTagId,
    required this.ownerId,
  });
}

