part of 'generated.dart';

class GetMessageByIdVariablesBuilder {
  String id;

  final FirebaseDataConnect _dataConnect;
  GetMessageByIdVariablesBuilder(this._dataConnect, {required  this.id,});
  Deserializer<GetMessageByIdData> dataDeserializer = (dynamic json)  => GetMessageByIdData.fromJson(jsonDecode(json));
  Serializer<GetMessageByIdVariables> varsSerializer = (GetMessageByIdVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<GetMessageByIdData, GetMessageByIdVariables>> execute() {
    return ref().execute();
  }

  QueryRef<GetMessageByIdData, GetMessageByIdVariables> ref() {
    GetMessageByIdVariables vars= GetMessageByIdVariables(id: id,);
    return _dataConnect.query("getMessageById", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class GetMessageByIdMessage {
  final String id;
  final String conversationId;
  final String senderId;
  final String content;
  final bool? isSystem;
  final Timestamp? createdAt;
  final GetMessageByIdMessageUser user;
  GetMessageByIdMessage.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  conversationId = nativeFromJson<String>(json['conversationId']),
  senderId = nativeFromJson<String>(json['senderId']),
  content = nativeFromJson<String>(json['content']),
  isSystem = json['isSystem'] == null ? null : nativeFromJson<bool>(json['isSystem']),
  createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
  user = GetMessageByIdMessageUser.fromJson(json['user']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

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

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['conversationId'] = nativeToJson<String>(conversationId);
    json['senderId'] = nativeToJson<String>(senderId);
    json['content'] = nativeToJson<String>(content);
    if (isSystem != null) {
      json['isSystem'] = nativeToJson<bool?>(isSystem);
    }
    if (createdAt != null) {
      json['createdAt'] = createdAt!.toJson();
    }
    json['user'] = user.toJson();
    return json;
  }

  GetMessageByIdMessage({
    required this.id,
    required this.conversationId,
    required this.senderId,
    required this.content,
    this.isSystem,
    this.createdAt,
    required this.user,
  });
}

@immutable
class GetMessageByIdMessageUser {
  final String? fullName;
  GetMessageByIdMessageUser.fromJson(dynamic json):
  
  fullName = json['fullName'] == null ? null : nativeFromJson<String>(json['fullName']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final GetMessageByIdMessageUser otherTyped = other as GetMessageByIdMessageUser;
    return fullName == otherTyped.fullName;
    
  }
  @override
  int get hashCode => fullName.hashCode;
  

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

  GetMessageByIdMessageUser({
    this.fullName,
  });
}

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

    final GetMessageByIdData otherTyped = other as GetMessageByIdData;
    return message == otherTyped.message;
    
  }
  @override
  int get hashCode => message.hashCode;
  

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

  GetMessageByIdData({
    this.message,
  });
}

@immutable
class GetMessageByIdVariables {
  final String id;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  GetMessageByIdVariables.fromJson(Map<String, 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 GetMessageByIdVariables otherTyped = other as GetMessageByIdVariables;
    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;
  }

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

