part of 'generated.dart';

class UpdateConversationVariablesBuilder {
  String id;
  Optional<String> _subject = Optional.optional(nativeFromJson, nativeToJson);
  Optional<ConversationStatus> _status = Optional.optional((data) => ConversationStatus.values.byName(data), enumSerializer);
  Optional<ConversationType> _conversationType = Optional.optional((data) => ConversationType.values.byName(data), enumSerializer);
  Optional<bool> _isGroup = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _groupName = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _lastMessage = Optional.optional(nativeFromJson, nativeToJson);
  Optional<Timestamp> _lastMessageAt = Optional.optional((json) => json['lastMessageAt'] = Timestamp.fromJson(json['lastMessageAt']), defaultSerializer);

  final FirebaseDataConnect _dataConnect;  UpdateConversationVariablesBuilder subject(String? t) {
   _subject.value = t;
   return this;
  }
  UpdateConversationVariablesBuilder status(ConversationStatus? t) {
   _status.value = t;
   return this;
  }
  UpdateConversationVariablesBuilder conversationType(ConversationType? t) {
   _conversationType.value = t;
   return this;
  }
  UpdateConversationVariablesBuilder isGroup(bool? t) {
   _isGroup.value = t;
   return this;
  }
  UpdateConversationVariablesBuilder groupName(String? t) {
   _groupName.value = t;
   return this;
  }
  UpdateConversationVariablesBuilder lastMessage(String? t) {
   _lastMessage.value = t;
   return this;
  }
  UpdateConversationVariablesBuilder lastMessageAt(Timestamp? t) {
   _lastMessageAt.value = t;
   return this;
  }

  UpdateConversationVariablesBuilder(this._dataConnect, {required  this.id,});
  Deserializer<UpdateConversationData> dataDeserializer = (dynamic json)  => UpdateConversationData.fromJson(jsonDecode(json));
  Serializer<UpdateConversationVariables> varsSerializer = (UpdateConversationVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<UpdateConversationData, UpdateConversationVariables>> execute() {
    return ref().execute();
  }

  MutationRef<UpdateConversationData, UpdateConversationVariables> ref() {
    UpdateConversationVariables vars= UpdateConversationVariables(id: id,subject: _subject,status: _status,conversationType: _conversationType,isGroup: _isGroup,groupName: _groupName,lastMessage: _lastMessage,lastMessageAt: _lastMessageAt,);
    return _dataConnect.mutation("updateConversation", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final UpdateConversationData otherTyped = other as UpdateConversationData;
    return conversation_update == otherTyped.conversation_update;
    
  }
  @override
  int get hashCode => conversation_update.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if (conversation_update != null) {
      json['conversation_update'] = conversation_update!.toJson();
    }
    return json;
  }

  UpdateConversationData({
    this.conversation_update,
  });
}

@immutable
class UpdateConversationVariables {
  final String id;
  late final Optional<String>subject;
  late final Optional<ConversationStatus>status;
  late final Optional<ConversationType>conversationType;
  late final Optional<bool>isGroup;
  late final Optional<String>groupName;
  late final Optional<String>lastMessage;
  late final Optional<Timestamp>lastMessageAt;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  UpdateConversationVariables.fromJson(Map<String, dynamic> json):
  
  id = nativeFromJson<String>(json['id']) {
  
  
  
    subject = Optional.optional(nativeFromJson, nativeToJson);
    subject.value = json['subject'] == null ? null : nativeFromJson<String>(json['subject']);
  
  
    status = Optional.optional((data) => ConversationStatus.values.byName(data), enumSerializer);
    status.value = json['status'] == null ? null : ConversationStatus.values.byName(json['status']);
  
  
    conversationType = Optional.optional((data) => ConversationType.values.byName(data), enumSerializer);
    conversationType.value = json['conversationType'] == null ? null : ConversationType.values.byName(json['conversationType']);
  
  
    isGroup = Optional.optional(nativeFromJson, nativeToJson);
    isGroup.value = json['isGroup'] == null ? null : nativeFromJson<bool>(json['isGroup']);
  
  
    groupName = Optional.optional(nativeFromJson, nativeToJson);
    groupName.value = json['groupName'] == null ? null : nativeFromJson<String>(json['groupName']);
  
  
    lastMessage = Optional.optional(nativeFromJson, nativeToJson);
    lastMessage.value = json['lastMessage'] == null ? null : nativeFromJson<String>(json['lastMessage']);
  
  
    lastMessageAt = Optional.optional((json) => json['lastMessageAt'] = Timestamp.fromJson(json['lastMessageAt']), defaultSerializer);
    lastMessageAt.value = json['lastMessageAt'] == null ? null : Timestamp.fromJson(json['lastMessageAt']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateConversationVariables otherTyped = other as UpdateConversationVariables;
    return id == otherTyped.id && 
    subject == otherTyped.subject && 
    status == otherTyped.status && 
    conversationType == otherTyped.conversationType && 
    isGroup == otherTyped.isGroup && 
    groupName == otherTyped.groupName && 
    lastMessage == otherTyped.lastMessage && 
    lastMessageAt == otherTyped.lastMessageAt;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, subject.hashCode, status.hashCode, conversationType.hashCode, isGroup.hashCode, groupName.hashCode, lastMessage.hashCode, lastMessageAt.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    if(subject.state == OptionalState.set) {
      json['subject'] = subject.toJson();
    }
    if(status.state == OptionalState.set) {
      json['status'] = status.toJson();
    }
    if(conversationType.state == OptionalState.set) {
      json['conversationType'] = conversationType.toJson();
    }
    if(isGroup.state == OptionalState.set) {
      json['isGroup'] = isGroup.toJson();
    }
    if(groupName.state == OptionalState.set) {
      json['groupName'] = groupName.toJson();
    }
    if(lastMessage.state == OptionalState.set) {
      json['lastMessage'] = lastMessage.toJson();
    }
    if(lastMessageAt.state == OptionalState.set) {
      json['lastMessageAt'] = lastMessageAt.toJson();
    }
    return json;
  }

  UpdateConversationVariables({
    required this.id,
    required this.subject,
    required this.status,
    required this.conversationType,
    required this.isGroup,
    required this.groupName,
    required this.lastMessage,
    required this.lastMessageAt,
  });
}

