part of 'generated.dart';

class CreateMessageVariablesBuilder {
  String conversationId;
  String senderId;
  String content;
  Optional<bool> _isSystem = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  CreateMessageVariablesBuilder isSystem(bool? t) {
   _isSystem.value = t;
   return this;
  }

  CreateMessageVariablesBuilder(this._dataConnect, {required  this.conversationId,required  this.senderId,required  this.content,});
  Deserializer<CreateMessageData> dataDeserializer = (dynamic json)  => CreateMessageData.fromJson(jsonDecode(json));
  Serializer<CreateMessageVariables> varsSerializer = (CreateMessageVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateMessageData, CreateMessageVariables>> execute() {
    return ref().execute();
  }

  MutationRef<CreateMessageData, CreateMessageVariables> ref() {
    CreateMessageVariables vars= CreateMessageVariables(conversationId: conversationId,senderId: senderId,content: content,isSystem: _isSystem,);
    return _dataConnect.mutation("createMessage", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final CreateMessageData otherTyped = other as CreateMessageData;
    return message_insert == otherTyped.message_insert;
    
  }
  @override
  int get hashCode => message_insert.hashCode;
  

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

  CreateMessageData({
    required this.message_insert,
  });
}

@immutable
class CreateMessageVariables {
  final String conversationId;
  final String senderId;
  final String content;
  late final Optional<bool>isSystem;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  CreateMessageVariables.fromJson(Map<String, dynamic> json):
  
  conversationId = nativeFromJson<String>(json['conversationId']),
  senderId = nativeFromJson<String>(json['senderId']),
  content = 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 CreateMessageVariables otherTyped = other as CreateMessageVariables;
    return conversationId == otherTyped.conversationId && 
    senderId == otherTyped.senderId && 
    content == otherTyped.content && 
    isSystem == otherTyped.isSystem;
    
  }
  @override
  int get hashCode => Object.hashAll([conversationId.hashCode, senderId.hashCode, content.hashCode, isSystem.hashCode]);
  

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

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

