part of 'generated.dart';

class UpdateMessageVariablesBuilder {
  String id;
  Optional<String> _conversationId = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _senderId = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _content = Optional.optional(nativeFromJson, nativeToJson);
  Optional<bool> _isSystem = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  UpdateMessageVariablesBuilder conversationId(String? t) {
   _conversationId.value = t;
   return this;
  }
  UpdateMessageVariablesBuilder senderId(String? t) {
   _senderId.value = t;
   return this;
  }
  UpdateMessageVariablesBuilder content(String? t) {
   _content.value = t;
   return this;
  }
  UpdateMessageVariablesBuilder isSystem(bool? t) {
   _isSystem.value = t;
   return this;
  }

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

  MutationRef<UpdateMessageData, UpdateMessageVariables> ref() {
    UpdateMessageVariables vars= UpdateMessageVariables(id: id,conversationId: _conversationId,senderId: _senderId,content: _content,isSystem: _isSystem,);
    return _dataConnect.mutation("updateMessage", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final UpdateMessageData otherTyped = other as UpdateMessageData;
    return message_update == otherTyped.message_update;
    
  }
  @override
  int get hashCode => message_update.hashCode;
  

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

  UpdateMessageData({
    this.message_update,
  });
}

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

    final UpdateMessageVariables otherTyped = other as UpdateMessageVariables;
    return id == otherTyped.id && 
    conversationId == otherTyped.conversationId && 
    senderId == otherTyped.senderId && 
    content == otherTyped.content && 
    isSystem == otherTyped.isSystem;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, conversationId.hashCode, senderId.hashCode, content.hashCode, isSystem.hashCode]);
  

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

  UpdateMessageVariables({
    required this.id,
    required this.conversationId,
    required this.senderId,
    required this.content,
    required this.isSystem,
  });
}

