namespace EntitlementDAL.DTOs; // MPROVISIONINGJOB — one row per client, tracks the (currently 2-step) provisioning // pipeline. TrialMode/DeploymentType/DockerPackageUrl are schema-ready for later Demo // (Thread 3) / Docker (Thread 2) work but are not populated by any code yet. public class ProvisioningJobDTO { public int ProvisioningJobId { get; set; } public int ClientId { get; set; } public string IdmsEngagementRef { get; set; } = string.Empty; public byte ProvisioningMode { get; set; } // 0=QuickStart 1=Managed public byte TrialMode { get; set; } // 0=NotTrial 1=WithSampleData 2=Blank public int PlanId { get; set; } // See GB5Shared.Enums.Client.ClientDeploymentType (canonical, reconciled 2026-07-26 // against MCLIENT.DeploymentType, which previously used a different byte scheme). public byte DeploymentType { get; set; } // 0=SaaS 1=OnPrem 2=BYOCloud 3=Hybrid public byte JobStatus { get; set; } // 0=Queued 1=Running 2=Completed 3=Failed 4=PartialFail public string CurrentStep { get; set; } = string.Empty; public string CompletedSteps { get; set; } = "[]"; // JSON array of step names public string? LastError { get; set; } public byte RetryCount { get; set; } public DateTime? StartedOn { get; set; } public DateTime? CompletedOn { get; set; } public string? DockerPackageUrl { get; set; } public string RequestPayload { get; set; } = "{}"; // Set once the DB-provisioning step submits a SqlWorkbench ClientProvisioning // ChangeRequest — SW.MSWCHANGEREQUEST/MSWCLIENTDATABASE live in a different physical // database (Gb5system) with their own ID space; these are FK-by-convention only, // resolved via ClientOnboardingOrchestratorBLL's HTTP calls to SqlWorkbench, never // joined in SQL. Null until the DB-provisioning step is reached. public int? SwChangeRequestId { get; set; } public int? SwClientDatabaseId { get; set; } // JSON array of SW.MSWUPGRADEPACKAGE PackageIds still to submit, in order, after // SwChangeRequestId reaches Executed — set when the resolved DbModel provisioning chain // (039_ALTER_MSWUPGRADEPACKAGE_PackageChain.sql) has more than one package. Null/empty // means no more packages remain; the orchestrator proceeds to subscription creation. public string? PendingPackageChain { get; set; } // Real FK to TLEAD (same physical database — TLEAD is part of the shared platform DB, // §36.13's FullBaseSchema chunk set), mirroring TDEMOSESSION.LeadId's own already-shipped // design (§49) exactly. Nullable, not a NOT-NULL-DEFAULT(-1) sentinel — TLEAD carries 9+ of // its own NOT NULL FK constraints, so a safe -1 sentinel row there is unverified (§52.3). // Set directly for staff-initiated onboarding (OnboardClientRequestDTO.LeadId); previously // this only reached the job's own serialized RequestPayload JSON audit trail — this column // makes it independently queryable/reportable. public int? LeadId { get; set; } // audit tail public short Version { get; set; } public byte Status { get; set; } = 1; public int SortOrder { get; set; } public int CreatedById { get; set; } public DateTime CreatedOn { get; set; } public int ModifiedById { get; set; } public DateTime ModifiedOn { get; set; } public byte SourceType { get; set; } public int TenantId { get; set; } = -1; }