namespace EnablementDAL.DTO; // ============================================================================= // ShowRunDTO — maps to TSHOWRUN // Used for: INSERT_SHOW_RUN, GET_SHOW_RUN_HISTORY // All property names must match Dapper's column-to-property mapping // (case-insensitive by default, or via ColumnAttribute if configured). // ============================================================================= public class ShowRunDTO { // PK — caller must generate before insert (e.g. from a sequence or ID service) public int ShowRunId { get; set; } // FK to TSHOW public int ShowId { get; set; } // User who triggered the show public int UserId { get; set; } // Client-generated correlation ID, ties back to LSHOWREQUEST public string RequestId { get; set; } = string.Empty; // 0=InProgress, 1=Completed, 2=Dismissed, 3=Expired, 4=Failed public byte RunState { get; set; } // 0=Auto, 1=Manual, 2=Channel, 3=Schedule public byte StartedBy { get; set; } // FIX: was CurrentStepId — actual DDL column is CURRENTSHOWSTEPID // -1 = not yet started; updated as user navigates steps public int CurrentShowStepId { get; set; } = -1; public DateTime StartedOn { get; set; } = DateTime.UtcNow; public DateTime? CompletedOn { get; set; } // JSON snapshot of trigger context at time of run (module, screen, role etc.) public string? TriggerSnapshot { get; set; } // Standard fields public short Version { get; set; } = 0; public byte Status { get; set; } = 1; public short SortOrder { get; set; } = 9999; 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; } = 5; // FIX: TenantId is a required NOT NULL column — must be set from login.ClientId public int TenantId { get; set; } } // ============================================================================= // ShowRunStepDTO — maps to TSHOWRUNSTEP // Used for: INSERT_SHOW_RUN_STEP // Note: TSHOWRUNSTEP has NO standard fields per convention (detail table). // ============================================================================= public class ShowRunStepDTO { // FIX: PK was missing from original insert — must be provided by caller public int ShowRunStepId { get; set; } // FK to TSHOWRUN public int ShowRunId { get; set; } // Sequence within this run (1-based step visit order) public short SlNo { get; set; } = 1; // FIX: was StepId — actual DDL column is SHOWSTEPID (FK to TSHOWSTEP) public int ShowStepId { get; set; } // 0=Reached, 1=Completed, 2=Skipped public byte StepState { get; set; } // 0=Next, 1=Previous, 2=GotoStep, 3=Complete, 4=Dismiss, 5=AutoAdvanced public byte ActionTaken { get; set; } // JSON payload: assessment answers, ack flags, form values etc. public string? ActionPayload { get; set; } // Time in milliseconds the user spent on this step public int TimeSpentOnMs { get; set; } public DateTime SteppedOn { get; set; } = DateTime.UtcNow; }