namespace JobTrackerApi.Models;

public static class EmailSendStatuses
{
    public const string Pending = "pending";
    public const string Sending = "sending";
    public const string Sent = "sent";
    public const string Failed = "failed";
    public const string Uncertain = "uncertain";
}

public sealed class EmailSendAttempt
{
    public Guid Id { get; set; }
    public string OwnerUserId { get; set; } = string.Empty;
    public int JobApplicationId { get; set; }
    public JobApplication JobApplication { get; set; } = null!;
    public string Provider { get; set; } = string.Empty;
    public string ClientRequestId { get; set; } = string.Empty;
    public string PayloadHash { get; set; } = string.Empty;
    public string Status { get; set; } = EmailSendStatuses.Pending;
    public string? ProviderMessageId { get; set; }
    public string? FailureCategory { get; set; }
    public DateTime CreatedAtUtc { get; set; }
    public DateTime? StartedAtUtc { get; set; }
    public DateTime? CompletedAtUtc { get; set; }
}

public sealed record EmailSendAttemptExport(
    Guid Id,
    int JobApplicationId,
    string Provider,
    string ClientRequestId,
    string Status,
    string? ProviderMessageId,
    string? FailureCategory,
    DateTime CreatedAtUtc,
    DateTime? StartedAtUtc,
    DateTime? CompletedAtUtc);
