using GB5Shared.ListQuery;
namespace PIEDAL.DTO.Profile;
// ── MPIEPROFILE — save / edit ─────────────────────────────────────────────────
public class PIEProfileDTO
{
public Guid ProfileId { get; set; }
public string ProfileCode { get; set; } = string.Empty;
public string ProfileName { get; set; } = string.Empty;
/// Manufacturing | Trading | Services | Healthcare | ...
public string Industry { get; set; } = string.Empty;
public int CompanySizeMin { get; set; }
public int? CompanySizeMax { get; set; }
/// India | GCC | SEA | Global
public string Geography { get; set; } = string.Empty;
/// Integer version number — incremented on each publish
public short Version { get; set; } = 1;
/// 1=Draft 2=Active 3=Deprecated
public short Status { get; set; } = 1;
public int UsageCount { get; set; }
public decimal? AvgCompletionDays { get; set; }
public decimal? AvgReworkRate { get; set; }
public DateTime? PublishedAt { get; set; }
public int PublishedBy { get; set; }
public Guid? PreviousVersionId { get; set; }
public string? MatchKeywords { 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 Modules { get; set; } = new();
public List VariantDefaults { get; set; } = new();
public List KpiItems { get; set; } = new();
public List DeviationQuestions { get; set; } = new();
}
// ── MPIEPROFILEMODULE — child ─────────────────────────────────────────────────
public class PIEProfileModuleDTO
{
public Guid ProfileModuleId { get; set; }
public Guid ProfileId { get; set; }
public Guid ModuleId { get; set; }
/// Display-only — joined on GET
public string? ModuleName { get; set; }
public string? ModuleGroup { get; set; }
/// ISPRIMARY: 1=Yes, 0=No
public short IsPrimary { get; set; }
public int SequenceOrder { get; set; }
public int TenantId { get; set; }
}
// ── MPIEPROFILEVARIANTDEFAULT — child ─────────────────────────────────────────
public class PIEProfileVariantDefaultDTO
{
public Guid PvdId { get; set; }
public Guid ProfileId { get; set; }
public Guid VariantId { get; set; }
/// Display-only — joined on GET
public string? VariantCode { get; set; }
public string? VariantName { get; set; }
public Guid? ModuleId { get; set; }
public int TenantId { get; set; }
}
// ── MPIEPROFILEKPI — child ────────────────────────────────────────────────────
public class PIEProfileKpiDTO
{
public Guid ProfileKpiId { get; set; }
public Guid ProfileId { get; set; }
public Guid KpiId { get; set; }
/// Display-only — joined on GET
public string? KpiCode { get; set; }
public string? KpiName { get; set; }
/// ISPRIMARY: 1=Yes, 0=No
public short IsPrimary { get; set; }
public int SequenceOrder { get; set; }
public int TenantId { get; set; }
}
// ── MPIEDEVIATIONQUESTION — child ─────────────────────────────────────────────
public class PIEDeviationQuestionDTO
{
public Guid QuestionId { get; set; }
public Guid ProfileId { get; set; }
public string QuestionCode { get; set; } = string.Empty;
public string QuestionText { get; set; } = string.Empty;
public string? HelpText { get; set; }
/// 1=YesNo 2=SingleChoice 3=MultiChoice
public short AnswerType { get; set; } = 1;
/// [{value, label, plainLanguageDesc}] — serialized as JSON string
public string? Options { get; set; }
public int SequenceOrder { get; set; }
/// STATUS: 1=Active, 0=Inactive
public short IsActive { get; set; } = 1;
public DateTime? CreatedAt { get; set; }
public int CreatedBy { get; set; }
public int TenantId { get; set; }
public List Implications { get; set; } = new();
}
// ── MPIEDEVIATIONIMPLICATION — child ──────────────────────────────────────────
public class PIEDeviationImplicationDTO
{
public Guid ImplicationId { get; set; }
public Guid QuestionId { get; set; }
public string AnswerValue { get; set; } = string.Empty;
///
/// 1=AddConfigItem 2=RemoveConfigItem 3=AddTrainingTopic
/// 4=AddUATScenario 5=AddMigrationObject 6=UpdateEffortHours
///
public short ImplicationType { get; set; }
/// Required for types 1–5; null for type 6
public Guid? RefId { get; set; }
public string? RefCode { get; set; }
public decimal EffortDeltaHours { get; set; }
public string? Description { get; set; }
public int TenantId { get; set; }
}
// ── Profile list infrastructure ───────────────────────────────────────────────
public sealed class PIEProfileListDTO
{
public Guid ProfileId { get; set; }
public string ProfileCode { get; set; } = string.Empty;
public string ProfileName { get; set; } = string.Empty;
public string Industry { get; set; } = string.Empty;
public string Geography { get; set; } = string.Empty;
public short Status { get; set; }
public short Version { get; set; }
public int UsageCount { get; set; }
public int TotalCount { get; set; }
}
public sealed class PIEProfileListCriteria : ICriteria
{
[CriteriaField("industry")] public string? Industry { get; set; }
[CriteriaField("geography")] public string? Geography { get; set; }
[CriteriaField("status")] public short? Status { 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 PIEProfileListQuery(PIEProfileListCriteria Criteria)
: IListQuery;
// ── Profile match request / result (QuickStart integration) ──────────────────
public sealed class PIEProfileMatchRequestDTO
{
public string Industry { get; set; } = string.Empty;
public string Geography { get; set; } = string.Empty;
public int CompanySize { get; set; }
public List ModuleIds { get; set; } = new();
}
public sealed class PIEProfileMatchResultDTO
{
public Guid ProfileId { get; set; }
public string ProfileCode { get; set; } = string.Empty;
public string ProfileName { get; set; } = string.Empty;
public decimal ConfidenceScore { get; set; }
public List DeviationQuestions { get; set; } = new();
}
// ── Deviation question option helper (for JSON serialization) ─────────────────
public sealed class PIEDeviationOptionDTO
{
public string Value { get; set; } = string.Empty;
public string Label { get; set; } = string.Empty;
public string? PlainLanguageDesc { get; set; }
}
// ── Profile select list (dropdown) ────────────────────────────────────────────
public sealed class PIEProfileSelectListDTO
{
public Guid ProfileId { get; set; }
public string ProfileCode { get; set; } = string.Empty;
public string ProfileName { get; set; } = string.Empty;
public short Version { get; set; }
}