namespace Ikar.Shared;

public enum MessageDeliveryState
{
    Sent = 0,
    Delivered = 1,
    Read = 2
}

public sealed record AttachmentDto(
    Guid Id,
    string FileName,
    string ContentType,
    long FileSizeBytes,
    string DownloadPath,
    AttachmentKind Kind,
    int SortOrder = 0);

public sealed record MessageReplyDto(
    Guid MessageId,
    Guid SenderId,
    string SenderDisplayName,
    string PreviewText);

public sealed record MessageReactionDto(
    string Emoji,
    int Count,
    bool IsMine);

public sealed record MessageDto(
    Guid Id,
    Guid ChatId,
    ChatType ChatType,
    UserSummaryDto Sender,
    string Text,
    IReadOnlyList<AttachmentDto> Attachments,
    DateTimeOffset SentAt,
    DateTimeOffset? EditedAt,
    DateTimeOffset? DeletedAt,
    MessageDeliveryState DeliveryState,
    string? ForwardedFromDisplayName = null,
    MessageReplyDto? ReplyTo = null,
    DateTimeOffset? PinnedAt = null,
    UserSummaryDto? PinnedBy = null,
    Guid? MediaAlbumId = null,
    IReadOnlyList<MessageReactionDto>? Reactions = null,
    bool HasProtectedContent = false,
    DateTimeOffset? ExpiresAt = null,
    int? TtlSeconds = null,
    bool PostedAsChannel = false,
    string? DisplayAuthorName = null,
    int? ViewCount = null);

public sealed record SendMessageRequest(
    string Text,
    Guid? ReplyToMessageId = null,
    Guid? TopicId = null,
    bool? HasProtectedContent = null,
    int? TtlSeconds = null);

public sealed record UpdateMessageRequest(string Text);

public sealed record UpdateMessageReceiptRequest(Guid MessageId);

public sealed record ForwardMessageRequest(Guid TargetChatId);

public sealed record SetMessageReactionRequest(string Emoji);

public sealed record ExpiredMessagesCleanupDto(int DeletedMessages, DateTimeOffset CleanedUpAt);
