using MediatR;

namespace ChatService.API.Application.Queries.Messages;

/// <summary>
/// EN: Query to get messages in a conversation.
/// VI: Query để lấy tin nhắn trong cuộc hội thoại.
/// </summary>
public record GetMessagesQuery(
    Guid ConversationId,
    Guid UserId,
    int Page = 1,
    int PageSize = 50,
    DateTime? Before = null
) : IRequest<GetMessagesResult>;

public record GetMessagesResult(
    IEnumerable<MessageDto> Messages,
    int TotalCount,
    int Page,
    int PageSize,
    bool HasMore
);

public record MessageDto(
    Guid Id,
    Guid ConversationId,
    Guid SenderId,
    string SenderName,
    string EncryptedContent,
    string Nonce,
    string? AuthTag,
    string Type,
    string Status,
    string? Metadata,
    Guid? ReplyToMessageId,
    DateTime CreatedAt,
    DateTime? DeliveredAt,
    DateTime? ReadAt
);
