namespace EntitlementDAL.Constants;
///
/// MPROVISIONINGJOB.CURRENTSTEP/COMPLETEDSTEPS are free-text (no CHECK constraint) — this class
/// formalizes the literal strings already written by the two independent pipelines that share
/// this one table, so both pipelines and every reader (ProvisioningService.GetStatusAsync,
/// ClientOnboardingOrchestratorBLL) reference one source of truth instead of scattered magic
/// strings. Values are unchanged from what was already being written — this is a naming
/// refactor, not a data migration.
///
/// The two pipelines never share a ProvisioningJobId and use disjoint step vocabularies:
/// - OnboardingOrchestratorSequence — ClientOnboardingOrchestratorBLL (Thread 6/§31): real
/// client identity + DB-per-tenant provisioning (via SqlWorkbench ChangeRequests) +
/// subscription creation, with an optional best-effort reference-data sync step.
/// - QuickStartSequence — ProvisioningService (the older, narrower pipeline): subscription +
/// entitlement seeding only, no DB provisioning at all.
///
public static class ProvisioningStepNames
{
// ── ClientOnboardingOrchestratorBLL pipeline ────────────────────────────────
public const string ClientIdentityCreated = "CLIENT_IDENTITY_CREATED";
public const string DbProvisioningCrSubmitted = "DB_PROVISIONING_CR_SUBMITTED";
public const string SubscriptionCreated = "SUBSCRIPTION_CREATED";
public const string SyncTriggered = "SYNC_TRIGGERED"; // optional, best-effort
public const string KeycloakProvisioned = "KEYCLOAK_PROVISIONED"; // optional, best-effort, SaaS-only
/// Canonical order of the literal values THIS pipeline actually pushes onto
/// CompletedSteps (not CurrentStep) — used by ProvisioningService.GetStatusAsync to count how
/// many of a job's real completed steps match this sequence, then compute a percentage
/// against this sequence's own length. Optional steps (SyncTriggered) are deliberately NOT
/// part of this sequence, so a best-effort step that fails/is skipped never leaves progress
/// permanently short of what's actually guaranteed to happen.
public static readonly string[] OnboardingOrchestratorSequence =
{
ClientIdentityCreated,
DbProvisioningCrSubmitted,
SubscriptionCreated,
};
// ── ProvisioningService (QuickStart) pipeline ───────────────────────────────
// SubscriptionCreate/EntitlementSeed (no trailing D/-ED) are CurrentStep-only, in-progress
// markers — set BEFORE that step's own work finishes, never pushed onto CompletedSteps.
// CompletedSteps instead gets SubscriptionCreated ("...CREATED") once the subscription row is
// actually saved, and EntitlementSeeded once entitlements are actually seeded — see
// ProvisioningService.ProvisionSubscriptionAsync's own real completedSteps.Add(...) calls.
public const string SubscriptionCreate = "SUBSCRIPTION_CREATE";
public const string EntitlementSeed = "ENTITLEMENT_SEED";
public const string EntitlementSeeded = "ENTITLEMENT_SEEDED";
/// Canonical order of the literal CompletedSteps values THIS (QuickStart) pipeline
/// pushes — SubscriptionCreated is intentionally the same literal the orchestrator pipeline
/// also uses; GetStatusAsync always selects one sequence or the other via
/// ClientIdentityCreated's presence BEFORE counting, so there is no cross-pipeline
/// ambiguity despite the shared literal.
public static readonly string[] QuickStartSequence =
{
SubscriptionCreated,
EntitlementSeeded,
};
}