namespace JobTrackerApi.Models;

public static class AccountDeletionStatuses
{
    public const string Active = "active";
    public const string Pending = "pending";
    public const string Completed = "completed";
}

public static class AccountDeletionRequestStatuses
{
    public const string Pending = "pending";
    public const string Processing = "processing";
    public const string RetryRequired = "retry_required";
    public const string Completed = "completed";
}

public static class AccountDeletionStages
{
    public const string Requested = "requested";
    public const string QuarantiningFiles = "quarantining_files";
    public const string DeletingDatabase = "deleting_database";
    public const string PurgingFiles = "purging_files";
    public const string RecordingTombstone = "recording_tombstone";
    public const string Completed = "completed";
}

public sealed class AccountDeletionRequest
{
    public Guid Id { get; set; }
    public string OwnerUserId { get; set; } = string.Empty;
    public string OwnerKey { get; set; } = string.Empty;
    public string RequestedByUserId { get; set; } = string.Empty;
    public string Status { get; set; } = AccountDeletionRequestStatuses.Pending;
    public string Stage { get; set; } = AccountDeletionStages.Requested;
    public int AttemptCount { get; set; }
    public int DatabaseRowCount { get; set; }
    public int FileCount { get; set; }
    public string? WarningJson { get; set; }
    public string? LastErrorCategory { get; set; }
    public string? LastErrorMessage { get; set; }
    public DateTimeOffset RequestedAtUtc { get; set; }
    public DateTimeOffset? StartedAtUtc { get; set; }
    public DateTimeOffset? CompletedAtUtc { get; set; }
    public List<AccountDeletionFile> Files { get; set; } = new();
}

public sealed class AccountDeletionFile
{
    public long Id { get; set; }
    public Guid AccountDeletionRequestId { get; set; }
    public AccountDeletionRequest Request { get; set; } = null!;
    public string Category { get; set; } = string.Empty;
    public string OriginalPath { get; set; } = string.Empty;
    public string QuarantinePath { get; set; } = string.Empty;
    public string Status { get; set; } = "planned";
    public long ByteSize { get; set; }
    public string Sha256 { get; set; } = string.Empty;
}
