using GB5Shared.ListQuery;
namespace PIEDAL.DTO.Module;
// ── MPIEMODULE — save / edit ──────────────────────────────────────────────────
public class PIEModuleDTO
{
public Guid ModuleId { get; set; }
public string ModuleCode { get; set; } = string.Empty;
public string ModuleName { get; set; } = string.Empty;
public string ModuleGroup { get; set; } = string.Empty;
public string? Description { get; set; }
public string? IconKey { get; set; }
public int DisplayOrder { get; set; }
/// STATUS: 1=Active, 0=Inactive
[GB5Shared.EntityHandler.WorkflowStatusField]
public short IsActive { get; set; } = 1;
/// ISSTANDALONE: 0=No, 1=Yes
public short IsStandalone { get; set; }
public string? CmsContentRef { 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; }
// Child collections — populated on single-record GET; sent on save
public List Dependencies { get; set; } = new();
public List KpiItems { get; set; } = new();
}
// ── MPIEMODULEDEPENDENCY — child ──────────────────────────────────────────────
public class PIEModuleDependencyDTO
{
public Guid DependencyId { get; set; }
public Guid ModuleId { get; set; }
public Guid DependsOnModuleId { get; set; }
/// Display-only — joined on GET, not persisted here
public string? DependsOnModuleName { get; set; }
/// 1=Required 2=Recommended
public short DependencyType { get; set; } = 1;
public int TenantId { get; set; }
}
// ── MPIEKPI — save / edit ─────────────────────────────────────────────────────
public class PIEKpiDTO
{
public Guid KpiId { get; set; }
public Guid ModuleId { get; set; }
/// Display-only — joined on GET
public string? ModuleName { get; set; }
public string KpiCode { get; set; } = string.Empty;
public string KpiName { get; set; } = string.Empty;
/// 1=Efficiency 2=Accuracy 3=Adoption 4=Financial
public short KpiCategory { get; set; }
public string? Unit { get; set; }
public string? Description { get; set; }
public string? MeasurementGuide { get; set; }
/// STATUS: 1=Active, 0=Inactive
[GB5Shared.EntityHandler.WorkflowStatusField]
public short IsActive { get; set; } = 1;
public string? CmsContentRef { 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; }
}
// ── Module list infrastructure ────────────────────────────────────────────────
public sealed class PIEModuleListDTO
{
public Guid ModuleId { get; set; }
public string ModuleCode { get; set; } = string.Empty;
public string ModuleName { get; set; } = string.Empty;
public string ModuleGroup { get; set; } = string.Empty;
public short IsActive { get; set; }
public short IsStandalone { get; set; }
public int TotalCount { get; set; }
}
public sealed class PIEModuleListCriteria : ICriteria
{
[CriteriaField("modulegroup")] public string? ModuleGroup { 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 PIEModuleListQuery(PIEModuleListCriteria Criteria)
: IListQuery;
// ── KPI list infrastructure ───────────────────────────────────────────────────
public sealed class PIEKpiListDTO
{
public Guid KpiId { get; set; }
public Guid ModuleId { get; set; }
public string KpiCode { get; set; } = string.Empty;
public string KpiName { get; set; } = string.Empty;
public short KpiCategory { get; set; }
public short IsActive { get; set; }
public int TotalCount { get; set; }
}
public sealed class PIEKpiListCriteria : ICriteria
{
[CriteriaField("moduleid")] public Guid? ModuleId { get; set; }
[CriteriaField("category")] public short? KpiCategory { 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 PIEKpiListQuery(PIEKpiListCriteria Criteria)
: IListQuery;
// ── Module select list (dropdown) ─────────────────────────────────────────────
public sealed class PIEModuleSelectListDTO
{
public Guid ModuleId { get; set; }
public string ModuleCode { get; set; } = string.Empty;
public string ModuleName { get; set; } = string.Empty;
public string ModuleGroup { get; set; } = string.Empty;
}