using GB5Shared.ListQuery; namespace PIEDAL.DTO.Outcome; // ── TPIEOUTCOME — insert (from Dapr idms.engagement.completed event) ────────── public class PIEOutcomeDTO { public Guid OutcomeId { get; set; } /// IDMS EngagementId (external reference) public string EngagementRef { get; set; } = string.Empty; public Guid ModuleId { get; set; } public Guid? ProfileId { get; set; } /// Integer version number from the matched MPIEPROFILE public short? ProfileVersion { get; set; } /// 1=Quick 2=Standard 3=Complex 4=Enterprise public short EngagementType { get; set; } public string? Industry { get; set; } public int? CompanySize { get; set; } public string? Geography { get; set; } public decimal? EstimatedHours { get; set; } public decimal? ActualHours { get; set; } public decimal? ReworkHours { get; set; } public int ReworkCount { get; set; } public decimal? UatPassRate { get; set; } /// GOLIVESUCCESS: 1=Yes, 0=No public short? GoLiveSuccess { get; set; } public int? CompletionDays { get; set; } /// [{reasonCode, count, hours}] — serialized as JSON string public string? ReworkReasons { get; set; } /// [{configItemCode, wasChanged, newValue}] — serialized as JSON string public string? DeviationMap { get; set; } public DateTime RecordedAt { get; set; } = DateTime.UtcNow; /// /// Standard STATUS field (0=Pending, 1=Active, 2=Deleted, 3=Amended, 4=Inactive, 5=Archived). /// Inert today — no workflow rule is configured for PIE Outcome. Exists so /// BaseEntityAppService.SetDtoStatus has a valid target if one ever is. /// [GB5Shared.EntityHandler.WorkflowStatusField] public byte Status { get; set; } = 1; public int TenantId { get; set; } } // ── Outcome list infrastructure ─────────────────────────────────────────────── public sealed class PIEOutcomeListDTO { public Guid OutcomeId { get; set; } public string EngagementRef { get; set; } = string.Empty; public Guid ModuleId { get; set; } public string? ModuleName { get; set; } public string? Industry { get; set; } public string? Geography { get; set; } public decimal? ActualHours { get; set; } public decimal? EstimatedHours { get; set; } public short? GoLiveSuccess { get; set; } public DateTime RecordedAt { get; set; } public int TotalCount { get; set; } } public sealed class PIEOutcomeListCriteria : ICriteria { [CriteriaField("moduleid")] public Guid? ModuleId { get; set; } [CriteriaField("profileid")] public Guid? ProfileId { get; set; } [CriteriaField("industry")] public string? Industry { get; set; } [CriteriaField("geography")] public string? Geography { get; set; } [CriteriaField("engagementtype")] public short? EngagementType { get; set; } [CriteriaField("golivesuccess")] public short? GoLiveSuccess { get; set; } [CriteriaField("searchtext")] public string? SearchText { get; set; } [CriteriaField("ouid")] public int? OUId { get; set; } [CriteriaField("sortby")] public string? SortBy { get; set; } [CriteriaField("sortdesc")] public bool SortDesc { get; set; } [CriteriaField("pagesize")] public int PageSize { get; set; } = 100; [CriteriaField("pageoffset")] public int PageOffset { get; set; } = 0; } public sealed record PIEOutcomeListQuery(PIEOutcomeListCriteria Criteria) : IListQuery; // ── JSON helper DTOs ────────────────────────────────────────────────────────── public sealed class PIEReworkReasonDTO { public string ReasonCode { get; set; } = string.Empty; public int Count { get; set; } public decimal Hours { get; set; } } public sealed class PIEDeviationMapEntryDTO { public string ConfigItemCode { get; set; } = string.Empty; public bool WasChanged { get; set; } public string? NewValue { get; set; } }