part of 'generated.dart';

class UpdateConversationLastMessageVariablesBuilder {
  String id;
  Optional<String> _lastMessage = Optional.optional(nativeFromJson, nativeToJson);
  Optional<Timestamp> _lastMessageAt = Optional.optional((json) => json['lastMessageAt'] = Timestamp.fromJson(json['lastMessageAt']), defaultSerializer);

  final FirebaseDataConnect _dataConnect;  UpdateConversationLastMessageVariablesBuilder lastMessage(String? t) {
   _lastMessage.value = t;
   return this;
  }
  UpdateConversationLastMessageVariablesBuilder lastMessageAt(Timestamp? t) {
   _lastMessageAt.value = t;
   return this;
  }

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

  MutationRef<UpdateConversationLastMessageData, UpdateConversationLastMessageVariables> ref() {
    UpdateConversationLastMessageVariables vars= UpdateConversationLastMessageVariables(id: id,lastMessage: _lastMessage,lastMessageAt: _lastMessageAt,);
    return _dataConnect.mutation("updateConversationLastMessage", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final UpdateConversationLastMessageData otherTyped = other as UpdateConversationLastMessageData;
    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;
  }

  UpdateConversationLastMessageData({
    this.conversation_update,
  });
}

@immutable
class UpdateConversationLastMessageVariables {
  final String id;
  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.')
  UpdateConversationLastMessageVariables.fromJson(Map<String, dynamic> json):
  
  id = nativeFromJson<String>(json['id']) {
  
  
  
    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 UpdateConversationLastMessageVariables otherTyped = other as UpdateConversationLastMessageVariables;
    return id == otherTyped.id && 
    lastMessage == otherTyped.lastMessage && 
    lastMessageAt == otherTyped.lastMessageAt;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, lastMessage.hashCode, lastMessageAt.hashCode]);
  

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

  UpdateConversationLastMessageVariables({
    required this.id,
    required this.lastMessage,
    required this.lastMessageAt,
  });
}

