using TMSDAL.Enums; // ApprovalType, EnrollmentStatus namespace TMSDAL.DTO.TrainingEnrollment { // ════════════════════════════════════════════════════════════════════════ // PRIMARY DTO — full record, used for Insert / Get single // ════════════════════════════════════════════════════════════════════════ /// /// Full enrollment record DTO. /// Used for: SaveTrainingEnrollment (INSERT) and GetTrainingEnrollment (SELECT single). /// All nullable fields reflect NULL-able DB columns. /// public class TrainingEnrollmentDTO { // ── Identification ──────────────────────────────────────────────── public int EnrollmentId { get; set; } public string? EnrollmentCode { get; set; } public string? EnrollmentName { get; set; } // ── Instance / Programme (read-only joins on GET) ───────────────── public int InstanceId { get; set; } public string? InstanceCode { get; set; } public string? ProgrammeTitle { get; set; } // ── Employee (read-only join on GET) ────────────────────────────── public int EmployeeId { get; set; } public string? EmployeeName { get; set; } // ── Nomination ──────────────────────────────────────────────────── public byte NominationSource { get; set; } // NominationSource enum public int? NominatedById { get; set; } public string? NominatedByName { get; set; } // FIX: was int? — must be string? public DateTime NominatedOn { get; set; } // FIX: was missing // ── Manager Approval ────────────────────────────────────────────── public int? ManagerApprovalId { get; set; } public DateTime? ManagerApprovedOn { get; set; } public string? ManagerRemarks { get; set; } // per-tier audit trail // ── HR Approval ─────────────────────────────────────────────────── public int? HRApprovalId { get; set; } public DateTime? HRApprovedOn { get; set; } // FIX: renamed from HRProcessedOn public string? HRRemarks { get; set; } // per-tier audit trail // ── Enrollment State ────────────────────────────────────────────── public byte EnrollmentStatus { get; set; } // EnrollmentStatus enum public int WaitlistPosition { get; set; } // 0 = not on waitlist // ── Pre-Assessment ──────────────────────────────────────────────── public bool PreAssessmentDone { get; set; } // FIX: was missing (BIT in DB) public decimal PreAssessmentScore { get; set; } // FIX: was missing (NUMERIC 9,4 in DB) // ── Notes / Withdrawal ──────────────────────────────────────────── public string? Remarks { get; set; } // FIX: was missing public string? WithdrawalReason { get; set; } public DateTime? WithdrawnOn { get; set; } // ── Standard Fields ─────────────────────────────────────────────── public int TenantId { get; set; } public int CreatedById { get; set; } public DateTime CreatedOn { get; set; } public int ModifiedById { get; set; } public DateTime ModifiedOn { get; set; } } // ════════════════════════════════════════════════════════════════════════ // LIST DTO — lightweight, used for grids / tables // ════════════════════════════════════════════════════════════════════════ /// /// Lightweight enrollment record for list / grid display. /// Returned by: GetEnrollmentsByInstance, GetEnrollmentsByEmployee, GetEnrollmentList. /// public class TrainingEnrollmentListDTO { // ── Identification ──────────────────────────────────────────────── public int EnrollmentId { get; set; } public string EnrollmentCode { get; set; } = string.Empty; public string EnrollmentName { get; set; } = string.Empty; // ── Instance / Programme ────────────────────────────────────────── public int InstanceId { get; set; } public string InstanceCode { get; set; } = string.Empty; public string ProgrammeTitle { get; set; } = string.Empty; // ── Employee ────────────────────────────────────────────────────── public int EmployeeId { get; set; } public string EmployeeName { get; set; } = string.Empty; // ── State ───────────────────────────────────────────────────────── public byte NominationSource { get; set; } // NominationSource enum public byte EnrollmentStatus { get; set; } // EnrollmentStatus enum public int? WaitlistPosition { get; set; } // NULL = not on waitlist // ── Approval Timestamps (summary) ───────────────────────────────── public DateTime? ManagerApprovedOn { get; set; } public DateTime? HRApprovedOn { get; set; } // ── Audit ───────────────────────────────────────────────────────── public DateTime CreatedOn { get; set; } } // ════════════════════════════════════════════════════════════════════════ // PICKLIST DTO — minimal, used for dropdowns / lookups // ════════════════════════════════════════════════════════════════════════ /// /// Minimal enrollment record for dropdown / lookup use. /// InstanceCode + ProgrammeTitle give the UI a meaningful display label. /// public class TrainingEnrollmentPickListDTO { public int EnrollmentId { get; set; } public string EnrollmentCode { get; set; } = string.Empty; public string EnrollmentName { get; set; } = string.Empty; public string InstanceCode { get; set; } = string.Empty; public string ProgrammeTitle { get; set; } = string.Empty; } // ════════════════════════════════════════════════════════════════════════ // APPROVAL DTOs // ════════════════════════════════════════════════════════════════════════ /// /// API input DTO for approving or rejecting an enrollment (Manager or HR). /// ApprovalId is resolved by the BLL from the logged-in user. /// Status is set by the BLL based on ApprovalType + action taken. /// public class ApprovalActionDTO { public int EnrollmentId { get; set; } public ApprovalType ApprovalType { get; set; } // Manager | HR public EnrollmentStatus Status { get; set; } // strongly typed public string? Remarks { get; set; } } /// /// Internal DAL-only DTO. Built by BLL after resolving ApprovalId. /// Never exposed to the controller or API layer. /// public class ApprovalUpdateDTO { public int EnrollmentId { get; set; } public ApprovalType ApprovalType { get; set; } public EnrollmentStatus Status { get; set; } // strongly typed public int ApprovalId { get; set; } // resolved by BLL public string? Remarks { get; set; } } // ════════════════════════════════════════════════════════════════════════ // WITHDRAWAL DTO // ════════════════════════════════════════════════════════════════════════ /// /// API input DTO for withdrawing an enrollment. /// EnrollmentStatus is always set to EnrollmentStatus.Withdrawn by the BLL. /// public class WithdrawEnrollmentDTO { public int EnrollmentId { get; set; } public string? WithdrawalReason { get; set; } } }