using GB5Shared.ListQuery; namespace PIEDAL.DTO.Estimation; // ── MPIEESTIMATIONRULE — save / edit ────────────────────────────────────────── public class PIEEstimationRuleDTO { public Guid RuleId { get; set; } public Guid ModuleId { get; set; } /// Display-only — joined on GET public string? ModuleName { get; set; } /// 1=Quick 2=Standard 3=Complex 4=Enterprise public short EngagementType { get; set; } /// 1=Low 2=Medium 3=High public short ComplexityLevel { get; set; } = 2; public decimal BaseHours { get; set; } public decimal ConfigHours { get; set; } public decimal TrainingHours { get; set; } public decimal MigrationHours { get; set; } public decimal UatHours { get; set; } /// PM overhead percentage added on top of total public decimal PmOverheadPct { get; set; } = 15.00m; public decimal ConfidenceScore { get; set; } = 80.00m; /// STATUS: 1=Active, 0=Inactive [GB5Shared.EntityHandler.WorkflowStatusField] public short IsActive { get; set; } = 1; public DateTime ValidFrom { get; set; } = DateTime.UtcNow.Date; public DateTime? ValidTo { get; set; } public DateTime? CreatedAt { get; set; } public int CreatedBy { get; set; } public DateTime? UpdatedAt { get; set; } public int UpdatedBy { get; set; } public int TenantId { get; set; } } // ── MPIEESTIMATIONRULE — list ───────────────────────────────────────────────── public sealed class PIEEstimationRuleListDTO { public Guid RuleId { get; set; } public Guid ModuleId { get; set; } public string? ModuleName { get; set; } public short EngagementType { get; set; } public short ComplexityLevel { get; set; } public decimal BaseHours { get; set; } public decimal ConfidenceScore { get; set; } public short IsActive { get; set; } public int TotalCount { get; set; } } public sealed class PIEEstimationRuleListCriteria : ICriteria { [CriteriaField("moduleid")] public Guid? ModuleId { get; set; } [CriteriaField("engagementtype")] public short? EngagementType { get; set; } [CriteriaField("complexitylevel")] public short? ComplexityLevel { get; set; } [CriteriaField("isactive")] public short? IsActive { 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 PIEEstimationRuleListQuery(PIEEstimationRuleListCriteria Criteria) : IListQuery; // ── LPIEESTIMATIONSNAPSHOT — insert-only (immutable after creation) ──────────── public class PIEEstimationSnapshotDTO { public Guid SnapshotId { get; set; } public string EngagementRef { get; set; } = string.Empty; /// Full result payload — serialized as JSON string public string SnapshotData { get; set; } = "{}"; public decimal TotalHours { get; set; } public decimal ConfidenceScore { get; set; } public DateTime? CreatedAt { get; set; } public int CreatedBy { get; set; } public int TenantId { get; set; } /// Workflow status resolver target. Inert: no workflow rule is configured /// for this entity today; always 1 (Active). 0=Pending, 1=Active, 2=Deleted. [GB5Shared.EntityHandler.WorkflowStatusField] public byte Status { get; set; } = 1; } // ── Estimation calculation request / result (IDMS integration) ──────────────── public sealed class PIEEstimationRequestDTO { public Guid ProfileId { get; set; } public List ModuleIds { get; set; } = new(); public List VariantIds { get; set; } = new(); /// 1=Quick 2=Standard 3=Complex 4=Enterprise public short EngagementType { get; set; } = 2; /// 1=Low 2=Medium 3=High public short ComplexityLevel { get; set; } = 2; /// IDMS EngagementId — stored in snapshot for traceability public string EngagementRef { get; set; } = string.Empty; } public sealed class PIEEstimationResultDTO { public Guid SnapshotId { get; set; } public decimal TotalHours { get; set; } public decimal ConfidenceScore { get; set; } public List ModuleBreakdown { get; set; } = new(); } public sealed class PIEModuleEstimateDTO { public Guid ModuleId { get; set; } public string ModuleName { get; set; } = string.Empty; public decimal BaseHours { get; set; } public decimal ConfigHours { get; set; } public decimal TrainingHours { get; set; } public decimal MigrationHours { get; set; } public decimal UatHours { get; set; } public decimal TotalHours { get; set; } }