namespace TMSDAL.DTO.TrainingPlanDashboard { // ── 0. TRAINING TYPE META — FE color/legend lookup ─────────────────────── // Each ProgrammeType value maps to a name, PDF legend label, and hex color. // FE uses ProgrammeType (int) as the key to apply the correct color on charts. public class TrainingTypeMeta { public int ProgrammeType { get; set; } public string TypeName { get; set; } = string.Empty; public string LegendLabel { get; set; } = string.Empty; public string ColorCode { get; set; } = string.Empty; // hex e.g. #4CAF50 public string TextColor { get; set; } = string.Empty; // hex for text on bg public string PatternStyle { get; set; } = string.Empty; // solid|hatched|dotted|striped // Standard duration in days per training type — from the PDF legend // FE uses this to show expected duration alongside actual duration public int StandardDurationDays { get; set; } // Static lookup — returns the full list, no DB call needed public static List All() => new() { new() { ProgrammeType = 0, TypeName = "Induction", LegendLabel = "Induction Training", ColorCode = "#4CAF50", TextColor = "#FFFFFF", PatternStyle = "solid", StandardDurationDays = 3 }, new() { ProgrammeType = 1, TypeName = "Technical", LegendLabel = "Theoretical Training", ColorCode = "#9E9E9E", TextColor = "#FFFFFF", PatternStyle = "hatched", StandardDurationDays = 7 }, new() { ProgrammeType = 2, TypeName = "Behavioural", LegendLabel = "Behavioural Training", ColorCode = "#FF9800", TextColor = "#FFFFFF", PatternStyle = "solid", StandardDurationDays = 0 }, new() { ProgrammeType = 3, TypeName = "Safety", LegendLabel = "Safety Training", ColorCode = "#F44336", TextColor = "#FFFFFF", PatternStyle = "solid", StandardDurationDays = 0 }, new() { ProgrammeType = 4, TypeName = "Compliance", LegendLabel = "Compliance Training", ColorCode = "#9C27B0", TextColor = "#FFFFFF", PatternStyle = "solid", StandardDurationDays = 0 }, new() { ProgrammeType = 5, TypeName = "Leadership", LegendLabel = "Leadership Training", ColorCode = "#3F51B5", TextColor = "#FFFFFF", PatternStyle = "solid", StandardDurationDays = 0 }, new() { ProgrammeType = 6, TypeName = "CrossFunctional", LegendLabel = "Cross-Functional Training", ColorCode = "#00BCD4", TextColor = "#FFFFFF", PatternStyle = "solid", StandardDurationDays = 0 }, new() { ProgrammeType = 7, TypeName = "Dojo", LegendLabel = "Dojo Training", ColorCode = "#795548", TextColor = "#FFFFFF", PatternStyle = "dotted", StandardDurationDays = 0 }, new() { ProgrammeType = 8, TypeName = "OJT_Level1", LegendLabel = "On the Job Training Level 1", ColorCode = "#8BC34A", TextColor = "#000000", PatternStyle = "dotted", StandardDurationDays = 7 }, new() { ProgrammeType = 9, TypeName = "OJT_Level2", LegendLabel = "On the Job Training Level 2", ColorCode = "#CDDC39", TextColor = "#000000", PatternStyle = "striped", StandardDurationDays = 15 }, new() { ProgrammeType = 10, TypeName = "OJT_Level3", LegendLabel = "On the Job Training Level 3", ColorCode = "#FFC107", TextColor = "#000000", PatternStyle = "striped", StandardDurationDays = 30 }, new() { ProgrammeType = 11, TypeName = "OJT_Level4", LegendLabel = "On the Job Training Level 4", ColorCode = "#FF5722", TextColor = "#FFFFFF", PatternStyle = "striped", StandardDurationDays = 90 }, new() { ProgrammeType = 12, TypeName = "SoftSkills", LegendLabel = "Soft Skills Training", ColorCode = "#E91E63", TextColor = "#FFFFFF", PatternStyle = "solid", StandardDurationDays = 0 }, new() { ProgrammeType = 13, TypeName = "Refresher", LegendLabel = "Retraining / Refresher", ColorCode = "#607D8B", TextColor = "#FFFFFF", PatternStyle = "hatched", StandardDurationDays = 0 }, new() { ProgrammeType = 14, TypeName = "CertificationPrep", LegendLabel = "Certification Preparation", ColorCode = "#673AB7", TextColor = "#FFFFFF", PatternStyle = "solid", StandardDurationDays = 0 }, new() { ProgrammeType = 15, TypeName = "Coaching", LegendLabel = "Coaching / Mentoring", ColorCode = "#009688", TextColor = "#FFFFFF", PatternStyle = "solid", StandardDurationDays = 0 }, }; // Convenience: get single meta by ProgrammeType value public static TrainingTypeMeta Get(int programmeType) => All().FirstOrDefault(m => m.ProgrammeType == programmeType) ?? new() { ProgrammeType = programmeType, TypeName = "Unknown", LegendLabel = "Unknown", ColorCode = "#BDBDBD", TextColor = "#000000", PatternStyle = "solid" }; } // ── 0a. PLAN HEADER — flat DB row from GET_PLAN_HEADER query ───────────── public class PlanHeaderFlatDTO { public int? DepartmentId { get; set; } public string? DepartmentName { get; set; } public DateTime? UpdationDate { get; set; } public int? TrainingDomainId { get; set; } public string? DomainName { get; set; } } // ── 0b. PLAN HEADER — matches PDF document header ──────────────────────── public class TrainingPlanHeaderDTO { // From PDF document header public string? UpdationResponsibility { get; set; } // e.g. "Line Incharge" — caller-supplied public string? ReviewFrequency { get; set; } // e.g. "Every month / If new Associate join" — caller-supplied // Derived from DB public int? DepartmentId { get; set; } public string? DepartmentName { get; set; } // e.g. "4W PSMT" public DateTime? UpdationDate { get; set; } // latest MODIFIEDON from TTRAININGNEED for this dept/domain // Filter context — what this dashboard is scoped to public int? TrainingDomainId { get; set; } public string? DomainName { get; set; } public DateTime GeneratedOn { get; set; } // server time when dashboard was built } // ── 1. TOP-LEVEL KPI SUMMARY ───────────────────────────────────────────── public class TrainingPlanSummaryDTO { public int TotalTrainingNeeds { get; set; } public int TotalInstances { get; set; } public int TotalEnrollments { get; set; } public int CompletedThisYear { get; set; } public decimal OverallCompletionRate { get; set; } public decimal OverallPassRate { get; set; } public int CertificatesIssuedThisYear { get; set; } public int ExpiringCertificates30Days { get; set; } public int PendingNominations { get; set; } public int PendingHRApprovals { get; set; } public int TotalDomains { get; set; } public int TotalTrainers { get; set; } public int TotalProgrammes { get; set; } public int TotalEmployeesTrained { get; set; } } // ── 2. ENROLLMENT FUNNEL ───────────────────────────────────────────────── public class EnrollmentFunnelDTO { public int Nominated { get; set; } public int ManagerApproved { get; set; } public int HRApproved { get; set; } public int Waitlisted { get; set; } public int Enrolled { get; set; } public int Completed { get; set; } public int NoShow { get; set; } public int Withdrawn { get; set; } public int Rejected { get; set; } public int Total { get; set; } } // ── 3. INSTANCE LIST (all instances with full details) ─────────────────── public class InstanceStatusBreakdownDTO { public int InstanceId { get; set; } public string? InstanceCode { get; set; } public string? InstanceTitle { get; set; } public int ProgrammeId { get; set; } public string? ProgrammeCode { get; set; } public string? ProgrammeTitle { get; set; } // Training type fields — FE uses ColorCode to paint Gantt bars public int ProgrammeType { get; set; } public string? TrainingTypeName { get; set; } public string? ColorCode { get; set; } public string? PatternStyle { get; set; } public int TrainingDomainId { get; set; } public string? DomainName { get; set; } public DateTime PlannedStartDate { get; set; } public DateTime PlannedEndDate { get; set; } public DateTime? ActualStartDate { get; set; } public DateTime? ActualEndDate { get; set; } public int InstanceStatus { get; set; } public int EnrolledCount { get; set; } public int MaxCapacity { get; set; } public int MinCapacity { get; set; } public decimal CostPerParticipant { get; set; } public int TrainerType { get; set; } public string? TrainerName { get; set; } public string? VenueName { get; set; } public string? VenueLocation { get; set; } public int TotalSessions { get; set; } public int CompletedSessions { get; set; } public string? BatchNote { get; set; } // ── Training Time Period (Gantt bar data) ───────────────────────────── // Planned duration in calendar days public int PlannedDurationDays { get; set; } // Actual duration in calendar days (null if not yet completed) public int? ActualDurationDays { get; set; } // Standard duration for this training type (from PDF legend) public int StandardDurationDays { get; set; } // true when ActualEndDate > PlannedEndDate — FE shows Delay color public bool IsDelayed { get; set; } // true when instance is a retraining (ProgrammeType = 13) public bool IsRetraining { get; set; } // Month-year label for timeline axis e.g. "Oct-25" public string? StartMonthLabel { get; set; } public string? EndMonthLabel { get; set; } } // ── 3b. GANTT TIMELINE ──────────────────────────────────────────────────── // Flat DB result row — DAL groups into GanttRowDTO list public class GanttFlatRowDTO { public int EmployeeId { get; set; } public string? EmployeeCode { get; set; } public string? EmployeeName { get; set; } public int InstanceId { get; set; } public string? InstanceCode { get; set; } public string? ProgrammeTitle { get; set; } public int ProgrammeType { get; set; } public DateTime PlannedStartDate { get; set; } public DateTime PlannedEndDate { get; set; } public DateTime? ActualStartDate { get; set; } public DateTime? ActualEndDate { get; set; } public int PlannedDurationDays { get; set; } public int? ActualDurationDays { get; set; } public int EnrollmentStatus { get; set; } public int? CompletionStatus { get; set; } public int IsDelayed { get; set; } public int IsRetraining { get; set; } } // Grouped Gantt — one per employee // One row per employee, showing all their training bars across months. // FE renders this as the Gantt chart from the PDF. public class GanttRowDTO { // Sl.No. — sequential row number matching PDF column "Sl.No." public int SlNo { get; set; } public int EmployeeId { get; set; } // Emp No. — matches PDF column "Emp No." public string? EmployeeCode { get; set; } // Associate Name — matches PDF column "Associate Name" public string? EmployeeName { get; set; } public string? EmployeeThumbnail { get; set; } public List Bars { get; set; } = new(); } public class GanttBarDTO { public int InstanceId { get; set; } public string? InstanceCode { get; set; } // Short label shown on bar e.g. "B1&B2", "C8" public string? ProgrammeTitle { get; set; } public int ProgrammeType { get; set; } public string? TrainingTypeName { get; set; } public string? ColorCode { get; set; } public string? PatternStyle { get; set; } // ── PLAN bar (oval / outline shape in PDF) ──────────────────────────── public DateTime PlannedStartDate { get; set; } public DateTime PlannedEndDate { get; set; } public int PlannedDurationDays { get; set; } public int StandardDurationDays { get; set; } // Pre-computed week slots so FE can place bar without date math // Month index (0-based from timeline start), Week 1–4 public string PlannedStartMonthLabel { get; set; } = string.Empty; // "Apr-25" public int PlannedStartWeek { get; set; } // 1–4 public string PlannedEndMonthLabel { get; set; } = string.Empty; // "Jul-25" public int PlannedEndWeek { get; set; } // 1–4 // ── ACTUAL bar (filled rectangle in PDF) ───────────────────────────── public DateTime? ActualStartDate { get; set; } public DateTime? ActualEndDate { get; set; } public int? ActualDurationDays { get; set; } // Pre-computed week slots for actual bar (null when no actual dates) public string? ActualStartMonthLabel { get; set; } public int? ActualStartWeek { get; set; } public string? ActualEndMonthLabel { get; set; } public int? ActualEndWeek { get; set; } public int EnrollmentStatus { get; set; } public int? CompletionStatus { get; set; } public bool IsDelayed { get; set; } public bool IsRetraining { get; set; } } // ── GANTT MONTH/WEEK COLUMN HEADER ──────────────────────────────────────── // FE renders these as the top axis: Apr-25 | W1 W2 W3 W4 | May-25 | W1 W2 W3 W4 ... public class GanttMonthColumnDTO { public int MonthIndex { get; set; } // 0-based position in the timeline public string MonthLabel { get; set; } = string.Empty; // "Apr-25" public int Year { get; set; } public int Month { get; set; } // 1–12 } // ── 4. DOMAIN-WISE SUMMARY ─────────────────────────────────────────────── public class DomainCompletionDTO { public int TrainingDomainId { get; set; } public string? DomainCode { get; set; } public string? DomainName { get; set; } public int TotalInstances { get; set; } public int TotalEnrollments { get; set; } public int TotalEmployees { get; set; } public int Completed { get; set; } public int Failed { get; set; } public int InProgress { get; set; } public int Withdrawn { get; set; } public decimal CompletionRate { get; set; } public decimal PassRate { get; set; } public decimal AvgPostAssessmentScore { get; set; } public decimal AvgAttendancePct { get; set; } public int CertificatesIssued { get; set; } } // ── 5. DOMAIN EMPLOYEE DRILL-DOWN (all employees under a domain) ───────── public class DomainEmployeeDTO { // Sl.No. — sequential row number matching PDF "Sl.No." column public int SlNo { get; set; } // Employee identity public int EmployeeId { get; set; } // Emp No. — matches PDF column "Emp No." public string? EmployeeCode { get; set; } // Associate Name — matches PDF column "Associate Name" public string? EmployeeName { get; set; } // Enrollment info public int EnrollmentId { get; set; } public string? EnrollmentCode { get; set; } public int EnrollmentStatus { get; set; } public int NominationSource { get; set; } public DateTime NominatedOn { get; set; } // Instance / Programme info public int InstanceId { get; set; } public string? InstanceCode { get; set; } public string? InstanceTitle { get; set; } public int ProgrammeId { get; set; } public string? ProgrammeTitle { get; set; } public string? ProgrammeCode { get; set; } public DateTime PlannedStartDate { get; set; } public DateTime PlannedEndDate { get; set; } // Completion public int? CompletionStatus { get; set; } public DateTime? CompletedOn { get; set; } public decimal? OverallAttendancePct { get; set; } public decimal? PreAssessmentScore { get; set; } public decimal? PostAssessmentScore { get; set; } public decimal? ScoreImprovement { get; set; } public int? IsPassed { get; set; } public int? CertificateIssued { get; set; } // Certificate public string? CertificateNumber { get; set; } public string? CertificateTitle { get; set; } public DateTime? CertificateIssuedOn { get; set; } public DateTime? CertificateExpiryDate { get; set; } public int? CertStatus { get; set; } // Assessment public decimal? LatestAssessmentScore { get; set; } public int? AssessmentAttempts { get; set; } // Trainer public string? TrainerName { get; set; } public string? VenueName { get; set; } } // ── 6. TRAINER WORKLOAD ─────────────────────────────────────────────────── public class TrainerWorkloadDTO { public int TrainerId { get; set; } public string? TrainerCode { get; set; } public string? TrainerName { get; set; } public int TrainerType { get; set; } public int AssignedInstances { get; set; } public int UpcomingSessions { get; set; } public int CompletedSessionsThisYear { get; set; } public int TotalEnrollees { get; set; } public int CompletedEnrollees { get; set; } public decimal AvgRating { get; set; } } // ── 7. EXPIRING CERTIFICATES ───────────────────────────────────────────── public class ExpiringCertificateDTO { public int TrainingCertificateId { get; set; } public string? CertificateNumber { get; set; } public string? CertificateTitle { get; set; } public string? ProgrammeTitle { get; set; } public int EmployeeId { get; set; } public string? EmployeeCode { get; set; } public string? EmployeeName { get; set; } public DateTime IssuedOn { get; set; } public DateTime ExpiryDate { get; set; } public int DaysToExpiry { get; set; } public int RenewalWindowDays { get; set; } public int CertStatus { get; set; } public string? CertificateUrl { get; set; } } // ── 8. TRAINING NEEDS PIPELINE ─────────────────────────────────────────── public class TrainingNeedDTO { public int TrainingNeedId { get; set; } public string? NeedCode { get; set; } public string? NeedTitle { get; set; } public string? Description { get; set; } public int TrainingDomainId { get; set; } public string? DomainName { get; set; } public int NeedSourceType { get; set; } public int Priority { get; set; } public int AudienceType { get; set; } public int IsMandatory { get; set; } public int NeedStatus { get; set; } public int TargetHeadcount { get; set; } public DateTime? ComplianceDeadline { get; set; } public DateTime RaisedOn { get; set; } public string? RaisedByName { get; set; } public string? DepartmentName { get; set; } public int LinkedInstances { get; set; } } // ── 9. PROGRAMME PERFORMANCE ───────────────────────────────────────────── public class ProgrammePerformanceDTO { public int ProgrammeId { get; set; } public string? ProgrammeCode { get; set; } public string? ProgrammeTitle { get; set; } public string? DomainName { get; set; } // Training type — FE uses for color/legend public int ProgrammeType { get; set; } public string? TrainingTypeName { get; set; } public string? ColorCode { get; set; } public string? PatternStyle { get; set; } public int DeliveryMode { get; set; } public decimal DurationHours { get; set; } public int TotalInstances { get; set; } public int TotalEnrollments { get; set; } public int TotalCompletions { get; set; } public decimal CompletionRate { get; set; } public decimal AvgPostAssessmentScore { get; set; } public decimal PassMark { get; set; } public int CertificatesIssued { get; set; } } // ── 10. FULL COMBINED DASHBOARD ────────────────────────────────────────── public class TrainingPlanFullDashboardDTO { // Plan header — matches PDF document header fields public TrainingPlanHeaderDTO? PlanHeader { get; set; } // Legend — always returned so FE can build color map without hardcoding public List? TrainingTypeLegend { get; set; } public TrainingPlanSummaryDTO? Summary { get; set; } public EnrollmentFunnelDTO? EnrollmentFunnel { get; set; } public List? Instances { get; set; } public List? DomainCompletion { get; set; } // Populated only when TrainingDomainId filter is passed — all employees in that domain public List? DomainEmployees { get; set; } // Gantt column headers — month × week axis (Apr-25 W1..W4, May-25 W1..W4 ...) // FE builds the table header from this list; each month always has 4 week columns. public List? GanttMonthColumns { get; set; } // Gantt chart — one row per employee, bars per training instance public List? GanttTimeline { get; set; } public List? TrainerWorkload { get; set; } public List? ExpiringCertificates { get; set; } public List? TrainingNeeds { get; set; } public List? ProgrammePerformance { get; set; } } }