part of 'generated.dart';

class CreateConversationVariablesBuilder {
  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;
  CreateConversationVariablesBuilder subject(String? t) {
   _subject.value = t;
   return this;
  }
  CreateConversationVariablesBuilder status(ConversationStatus? t) {
   _status.value = t;
   return this;
  }
  CreateConversationVariablesBuilder conversationType(ConversationType? t) {
   _conversationType.value = t;
   return this;
  }
  CreateConversationVariablesBuilder isGroup(bool? t) {
   _isGroup.value = t;
   return this;
  }
  CreateConversationVariablesBuilder groupName(String? t) {
   _groupName.value = t;
   return this;
  }
  CreateConversationVariablesBuilder lastMessage(String? t) {
   _lastMessage.value = t;
   return this;
  }
  CreateConversationVariablesBuilder lastMessageAt(Timestamp? t) {
   _lastMessageAt.value = t;
   return this;
  }

  CreateConversationVariablesBuilder(this._dataConnect, );
  Deserializer<CreateConversationData> dataDeserializer = (dynamic json)  => CreateConversationData.fromJson(jsonDecode(json));
  Serializer<CreateConversationVariables> varsSerializer = (CreateConversationVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateConversationData, CreateConversationVariables>> execute() {
    return ref().execute();
  }

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

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

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

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

    final CreateConversationData otherTyped = other as CreateConversationData;
    return conversation_insert == otherTyped.conversation_insert;
    
  }
  @override
  int get hashCode => conversation_insert.hashCode;
  

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

  CreateConversationData({
    required this.conversation_insert,
  });
}

@immutable
class CreateConversationVariables {
  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.')
  CreateConversationVariables.fromJson(Map<String, dynamic> json) {
  
  
    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 CreateConversationVariables otherTyped = other as CreateConversationVariables;
    return 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([subject.hashCode, status.hashCode, conversationType.hashCode, isGroup.hashCode, groupName.hashCode, lastMessage.hashCode, lastMessageAt.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    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;
  }

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

