namespace BigRegister.Domain.Applications;
///
/// The post-submission aanvraag status lifecycle (ADR-0002): Ingediend → In
/// behandeling → (Meer info gevraagd ⇄) → Goedgekeurd/Afgewezen. Concept (pre-submission,
/// the wizard draft) is deliberately NOT a member here — see ,
/// which is null exactly when the aanvraag hasn't been submitted yet, instead of a sixth
/// "magic string" tag with no enum member to match it.
/// is reserved: no endpoint sets it yet (there is no state between
/// "just submitted" and "in behandeling" in this POC) — kept because the FE's status union
/// and $localize catalogue already declare it, and removing it would ripple into both.
///
public enum AanvraagStatusTag { Ingediend, InBehandeling, MeerInfoGevraagd, Goedgekeurd, Afgewezen }
///
/// A behandelaar's recorded decision — the three actions the beoordeling screen
/// offers, each advancing an aanvraag's .
///
public enum Besluit { Goedkeuren, Afwijzen, MeerInfoOpvragen }
///
/// The domain projection of an aanvraag's status at a point in time — the type
/// Aanvraag.StatusAt(now) returns, replacing the logic that used to live directly in
/// Contracts.Mappers.ToStatusDto. Constructible only via the factories below, so a
/// caller can never build e.g. a Referentie-less Goedgekeurd. is null only
/// for — the one construction path that used to be a bare "Concept"
/// string with no corresponding member.
///
public sealed class AanvraagStatus
{
public AanvraagStatusTag? Tag { get; }
public int? StepIndex { get; }
public int? StepCount { get; }
public string? Referentie { get; }
public bool? Manual { get; }
public string? Reden { get; }
private AanvraagStatus(AanvraagStatusTag? tag, int? stepIndex, int? stepCount, string? referentie, bool? manual, string? reden)
{
Tag = tag;
StepIndex = stepIndex;
StepCount = stepCount;
Referentie = referentie;
Manual = manual;
Reden = reden;
}
public static AanvraagStatus Concept(int stepIndex, int stepCount) =>
new(null, stepIndex, stepCount, null, null, null);
public static AanvraagStatus InBehandeling(string referentie, bool manual) =>
new(AanvraagStatusTag.InBehandeling, null, null, referentie, manual, null);
public static AanvraagStatus Goedgekeurd(string referentie) =>
new(AanvraagStatusTag.Goedgekeurd, null, null, referentie, null, null);
public static AanvraagStatus Afgewezen(string referentie, string? reden) =>
new(AanvraagStatusTag.Afgewezen, null, null, referentie, null, reden);
public static AanvraagStatus MeerInfoGevraagd(string referentie, string? reden) =>
new(AanvraagStatusTag.MeerInfoGevraagd, null, null, referentie, null, reden);
}