namespace MailApi.Models;

public class MailMessageResponse
{
    public string Id { get; set; } = string.Empty;

    public string SenderCharacterId { get; set; } = string.Empty;

    public string SenderCharacterName { get; set; } = string.Empty;

    public string RecipientCharacterId { get; set; } = string.Empty;

    public string RecipientCharacterName { get; set; } = string.Empty;

    public string Subject { get; set; } = string.Empty;

    public string Body { get; set; } = string.Empty;

    public DateTime CreatedUtc { get; set; }

    public DateTime? ReadUtc { get; set; }

    public static MailMessageResponse FromModel(MailMessage message) => new()
    {
        Id = message.Id ?? string.Empty,
        SenderCharacterId = message.SenderCharacterId,
        SenderCharacterName = message.SenderCharacterName,
        RecipientCharacterId = message.RecipientCharacterId,
        RecipientCharacterName = message.RecipientCharacterName,
        Subject = message.Subject,
        Body = message.Body,
        CreatedUtc = message.CreatedUtc,
        ReadUtc = message.ReadUtc
    };
}
