conversationSchemaGroup function

Map<String, dynamic> conversationSchemaGroup({
  1. required String name,
  2. required String description,
  3. required List<Map<String, dynamic>> userUuid,
  4. required String notes,
  5. required int messagesPerBox,
  6. required bool isGroup,
  7. required String conversationUUID,
  8. List<Map<String, dynamic>> infos = const [],
})

Creates a conversation schema for a group chat.

This function generates a standardized structure for group conversations, including metadata and user information.

Parameters:

  • name: The name of the conversation group.
  • description: A brief description of the conversation group.
  • userUuid: A list of user UUIDs participating in the conversation.
  • notes: Additional notes about the conversation.
  • messagesPerBox: The number of messages to display per message box.
  • isGroup: A boolean indicating whether this is a group conversation.
  • conversationUUID: A unique identifier for the conversation.

Returns a Map<String, dynamic> representing the conversation structure.

Implementation

Map<String, dynamic> conversationSchemaGroup({
  required String name,
  required String description,
  required List<Map<String, dynamic>> userUuid,
  required String notes,
  required int messagesPerBox,
  required bool isGroup,
  required String conversationUUID,
  List<Map<String, dynamic>> infos = const [],
}) {
  /// Get the current timestamp for creation and update times.
  DateTime now = DateTime.now();

  return {
    'schema-version': '1.0.0',
    'name': name,
    'description': description,
    'users': userUuid,
    'createdAt': now,
    'updatedAt': now,
    'notes': notes,
    'infos': infos,
    'messagesPerBox': messagesPerBox,
    'group': isGroup,
    'uuid': conversationUUID
  };
}