using SIGCM2.Domain.Exceptions;

namespace SIGCM2.Domain.Pricing.Exceptions;

/// <summary>
/// PRC-001 — Thrown when a reactivation attempt is blocked by a guard rule.
/// Maps to HTTP 409.
///
/// Reason codes:
///   ALREADY_ACTIVE       — target row is currently active (50410)
///   VIGENTE_EXISTS       — a different active row exists for (ProductTypeId, Symbol) (50411)
///   POSTERIOR_ROWS_EXIST — rows with higher ValidFrom exist after the target row (50412)
/// </summary>
public sealed class ChargeableCharConfigReactivationNotAllowedException : DomainException
{
    public long Id { get; }

    /// <summary>
    /// "ALREADY_ACTIVE" | "VIGENTE_EXISTS" | "POSTERIOR_ROWS_EXIST"
    /// </summary>
    public string Reason { get; }

    public ChargeableCharConfigReactivationNotAllowedException(long id, string reason)
        : base($"Reactivation not allowed for config {id}: {reason}")
    {
        Id = id;
        Reason = reason;
    }
}
