export type RequestStatus = 'Submitted' | 'HR Approved' | 'HOS Approved' | 'Finance Approved' | 'Rejected';
export type ApprovalStage = 'HR' | 'HOS' | 'Finance' | 'Complete' | 'Rejected';
export type EvalLevel = 'L1' | 'L2' | 'L3' | 'L4';
export type CertStatus = 'Submitted' | 'Pending' | 'Missing';

export type TrainingRequest = {
  id: string;
  employeeId: string;
  employeeName: string;
  dept: string;
  courseRequested: string;
  justification: string;
  preferredStartDate: string;
  preferredEndDate: string;
  estimatedCost: number;
  dateSubmitted: string;
  status: RequestStatus;
  currentStage: ApprovalStage;
  trainingProvider?: string;
  trainingMode?: string;
  regNo?: string;
  expectedOutcomes?: string;
  previousTraining?: boolean;
  employeeEmail?: string;
  proformaInvoice?: string;
  admissionLetter?: string;
  hrApprovedBy?: string;
  hrApprovedOn?: string;
  hosApprovedBy?: string;
  hosApprovedOn?: string;
  ceoApprovedBy?: string;
  financeApprovedBy?: string;
  financeApprovedOn?: string;
  rejectReason?: string;
  rejectedBy?: string;
  rejectedStage?: string;
  assignedProgramId?: string;
};

export type TrainingEvaluation = {
  id: string;
  programId: string;
  programTitle: string;
  employeeId: string;
  employeeName: string;
  dept: string;
  evalDate: string;
  l1Rating: number;
  l1Feedback: string;
  l2PreScore: number;
  l2PostScore: number;
  l2CertUploaded: boolean;
  l2Status: 'Pass' | 'Fail';
  l3Status: 'Pending' | 'Completed';
  l3AssessmentDate?: string;
  l3ManagerRating: number;
  l3Application: number;
  l3Confidence: number;
  l3LessSupervision: number;
  l3SharesLearning: number;
  l3Notes: string;
  l4KPI: string;
  l4Before: string;
  l4After: string;
  l4Improvement: string;
  l4ROI: string;
  l4MetricsImproved: boolean;
  l4Notes: string;
  completedDate: string;
};

export type IDPGoal = {
  id: string;
  goal: string;
  linkedTraining: string;
  targetDate: string;
  progress: number;
  status: 'Not Started' | 'In Progress' | 'Completed';
};

export type IDP = {
  id: string;
  employeeId: string;
  employeeName: string;
  dept: string;
  period: string;
  goals: IDPGoal[];
  managerSigned: boolean;
  managerName: string;
  createdDate: string;
  overallProgress: number;
  status: 'Active' | 'Completed' | 'On Hold';
};

export type TrainingRecord = {
  id: string;
  employeeId: string;
  employeeName: string;
  dept: string;
  courseName: string;
  provider: string;
  completionDate: string;
  certStatus: CertStatus;
  certUploadDate?: string;
  expiryDate?: string;
  daysToExpiry?: number;
  hoursAwarded: number;
  cost: number;
  daysSinceCompletion: number;
};

export const trainingRequests: TrainingRequest[] = [
  {
    id: 'REQ001',
    employeeId: 'UF001',
    employeeName: 'Jane Mwangi',
    dept: 'Monitoring & Evaluation',
    courseRequested: 'Advanced Data Analysis with Power BI',
    justification: 'Required to improve M&E dashboard reporting and data visualization capabilities for donor reporting.',
    preferredStartDate: '2026-05-10',
    preferredEndDate: '2026-05-12',
    estimatedCost: 45000,
    dateSubmitted: '2026-04-01',
    status: 'Submitted',
    currentStage: 'HR',
  },
  {
    id: 'REQ002',
    employeeId: 'UF005',
    employeeName: 'Grace Wanjiku',
    dept: 'Procurement',
    courseRequested: 'Public Procurement & Asset Disposal Act Training',
    justification: 'Mandatory compliance training for all procurement officers per PPRA guidelines.',
    preferredStartDate: '2026-05-20',
    preferredEndDate: '2026-05-21',
    estimatedCost: 28000,
    dateSubmitted: '2026-03-25',
    status: 'Finance Approved',
    currentStage: 'Complete',
    hrApprovedBy: 'HR Manager',
    hrApprovedOn: '2026-03-26',
    hosApprovedBy: 'Head of Secretariat',
    hosApprovedOn: '2026-03-28',
    financeApprovedBy: 'Finance Officer',
    financeApprovedOn: '2026-03-29',
    assignedProgramId: 'TR002',
  },
  {
    id: 'REQ003',
    employeeId: 'UF009',
    employeeName: 'Alice Odhiambo',
    dept: 'ICT',
    courseRequested: 'AWS Cloud Practitioner Certification',
    justification: 'Cloud migration project requires certified AWS professionals on the team.',
    preferredStartDate: '2026-06-01',
    preferredEndDate: '2026-06-30',
    estimatedCost: 62000,
    dateSubmitted: '2026-04-08',
    status: 'HR Approved',
    currentStage: 'HOS',
    hrApprovedBy: 'HR Manager',
    hrApprovedOn: '2026-04-09',
  },
  {
    id: 'REQ004',
    employeeId: 'UF003',
    employeeName: 'Mary Kamau',
    dept: 'Corporate Communication',
    courseRequested: 'Digital Media & Social Media Strategy',
    justification: 'To enhance digital communications capabilities and improve online stakeholder engagement.',
    preferredStartDate: '2026-05-15',
    preferredEndDate: '2026-05-16',
    estimatedCost: 35000,
    dateSubmitted: '2026-03-15',
    status: 'Rejected',
    currentStage: 'Rejected',
    rejectReason: 'Budget not available this quarter. Please resubmit in Q3 2026.',
    rejectedBy: 'HR Manager',
    rejectedStage: 'HR',
  },
  {
    id: 'REQ005',
    employeeId: 'UF012',
    employeeName: 'Brian Omondi',
    dept: 'ICT',
    courseRequested: 'Cisco CCNA Network Security',
    justification: 'To strengthen network infrastructure security and ensure compliance with government cybersecurity frameworks.',
    preferredStartDate: '2026-05-05',
    preferredEndDate: '2026-05-10',
    estimatedCost: 55000,
    dateSubmitted: '2026-04-10',
    status: 'HR Approved',
    currentStage: 'HOS',
    hrApprovedBy: 'HR Manager',
    hrApprovedOn: '2026-04-11',
  },
];

export const trainingEvaluations: TrainingEvaluation[] = [
  {
    id: 'EVAL001',
    programId: 'TR003',
    programTitle: 'ICT Security & Data Protection',
    employeeId: 'UF002',
    employeeName: 'Peter Otieno',
    dept: 'ICT',
    evalDate: '2026-03-22',
    l1Rating: 4,
    l1Feedback: 'Excellent delivery, very practical content. Could include more hands-on labs.',
    l2PreScore: 52,
    l2PostScore: 84,
    l2CertUploaded: true,
    l2Status: 'Pass',
    l3Status: 'Completed',
    l3AssessmentDate: '2026-05-20',
    l3ManagerRating: 4,
    l3Application: 4,
    l3Confidence: 4,
    l3LessSupervision: 3,
    l3SharesLearning: 4,
    l3Notes: 'Noticeably applying security protocols in daily work. Improved incident documentation.',
    l4KPI: 'Network Security Incidents',
    l4Before: '3 incidents/month',
    l4After: '0 incidents/month',
    l4Improvement: '100%',
    l4ROI: '340%',
    l4MetricsImproved: true,
    l4Notes: 'Zero security incidents since training. Network uptime improved to 99.7%.',
    completedDate: '2026-03-21',
  },
  {
    id: 'EVAL002',
    programId: 'TR006',
    programTitle: 'Performance Management Systems',
    employeeId: 'UF001',
    employeeName: 'Jane Mwangi',
    dept: 'Monitoring & Evaluation',
    evalDate: '2026-03-12',
    l1Rating: 5,
    l1Feedback: 'Transformative training. The KPI-setting frameworks are immediately applicable.',
    l2PreScore: 61,
    l2PostScore: 91,
    l2CertUploaded: true,
    l2Status: 'Pass',
    l3Status: 'Completed',
    l3AssessmentDate: '2026-05-10',
    l3ManagerRating: 5,
    l3Application: 5,
    l3Confidence: 5,
    l3LessSupervision: 4,
    l3SharesLearning: 5,
    l3Notes: 'Excellent application of SMART objectives. Team performance measurably improved.',
    l4KPI: 'M&E Report Quality Score',
    l4Before: '62%',
    l4After: '80%',
    l4Improvement: '+18%',
    l4ROI: '420%',
    l4MetricsImproved: true,
    l4Notes: 'Department M&E score improved by 18% in Q1 2026 assessment.',
    completedDate: '2026-03-11',
  },
  {
    id: 'EVAL003',
    programId: 'TR006',
    programTitle: 'Performance Management Systems',
    employeeId: 'UF008',
    employeeName: 'John Mutua',
    dept: 'Procurement',
    evalDate: '2026-03-12',
    l1Rating: 3,
    l1Feedback: 'Good content but pace was too fast. Need more time on complex topics.',
    l2PreScore: 55,
    l2PostScore: 72,
    l2CertUploaded: false,
    l2Status: 'Fail',
    l3Status: 'Completed',
    l3AssessmentDate: '2026-05-12',
    l3ManagerRating: 3,
    l3Application: 3,
    l3Confidence: 2,
    l3LessSupervision: 3,
    l3SharesLearning: 2,
    l3Notes: 'Some improvement observed but inconsistent application of learned frameworks.',
    l4KPI: 'Procurement Cycle Time',
    l4Before: '45 days',
    l4After: '43 days',
    l4Improvement: '-4%',
    l4ROI: '12%',
    l4MetricsImproved: false,
    l4Notes: 'Procurement cycle time largely unchanged. Follow-up coaching recommended.',
    completedDate: '2026-03-11',
  },
  {
    id: 'EVAL004',
    programId: 'TR003',
    programTitle: 'ICT Security & Data Protection',
    employeeId: 'UF009',
    employeeName: 'Alice Odhiambo',
    dept: 'ICT',
    evalDate: '2026-03-22',
    l1Rating: 4,
    l1Feedback: 'Very relevant to my daily work. Would appreciate advanced follow-up session.',
    l2PreScore: 48,
    l2PostScore: 86,
    l2CertUploaded: true,
    l2Status: 'Pass',
    l3Status: 'Pending',
    l3ManagerRating: 0,
    l3Application: 0,
    l3Confidence: 0,
    l3LessSupervision: 0,
    l3SharesLearning: 0,
    l3Notes: '',
    l4KPI: 'Code Security Compliance',
    l4Before: '70%',
    l4After: '70%',
    l4Improvement: 'Pending',
    l4ROI: 'Pending',
    l4MetricsImproved: false,
    l4Notes: 'Assessment pending — 60-day window not yet reached.',
    completedDate: '2026-03-21',
  },
  {
    id: 'EVAL005',
    programId: 'TR003',
    programTitle: 'ICT Security & Data Protection',
    employeeId: 'UF012',
    employeeName: 'Brian Omondi',
    dept: 'ICT',
    evalDate: '2026-03-22',
    l1Rating: 5,
    l1Feedback: 'Outstanding trainer. Real-world scenarios made the content very engaging.',
    l2PreScore: 58,
    l2PostScore: 90,
    l2CertUploaded: false,
    l2Status: 'Pass',
    l3Status: 'Pending',
    l3ManagerRating: 0,
    l3Application: 0,
    l3Confidence: 0,
    l3LessSupervision: 0,
    l3SharesLearning: 0,
    l3Notes: '',
    l4KPI: 'Network Uptime',
    l4Before: '97.2%',
    l4After: '97.2%',
    l4Improvement: 'Pending',
    l4ROI: 'Pending',
    l4MetricsImproved: false,
    l4Notes: 'Assessment pending — 60-day window not yet reached.',
    completedDate: '2026-03-21',
  },
  {
    id: 'EVAL006',
    programId: 'TR006',
    programTitle: 'Performance Management Systems',
    employeeId: 'UF007',
    employeeName: 'Fatuma Hassan',
    dept: 'Monitoring & Evaluation',
    evalDate: '2026-03-12',
    l1Rating: 4,
    l1Feedback: 'Very practical and well-structured. The group exercises were particularly useful.',
    l2PreScore: 60,
    l2PostScore: 88,
    l2CertUploaded: true,
    l2Status: 'Pass',
    l3Status: 'Completed',
    l3AssessmentDate: '2026-05-12',
    l3ManagerRating: 4,
    l3Application: 4,
    l3Confidence: 4,
    l3LessSupervision: 4,
    l3SharesLearning: 3,
    l3Notes: 'Consistently applying new performance frameworks. Shared learnings with team.',
    l4KPI: 'Data Quality Score',
    l4Before: '74%',
    l4After: '85%',
    l4Improvement: '+11%',
    l4ROI: '280%',
    l4MetricsImproved: true,
    l4Notes: 'Data quality score improved significantly. Fewer errors in quarterly reports.',
    completedDate: '2026-03-11',
  },
  {
    id: 'EVAL007',
    programId: 'TR006',
    programTitle: 'Performance Management Systems',
    employeeId: 'UF011',
    employeeName: 'Esther Njeri',
    dept: 'Monitoring & Evaluation',
    evalDate: '2026-03-12',
    l1Rating: 5,
    l1Feedback: 'Best training I have attended. Highly recommend for all M&E staff.',
    l2PreScore: 65,
    l2PostScore: 93,
    l2CertUploaded: true,
    l2Status: 'Pass',
    l3Status: 'Completed',
    l3AssessmentDate: '2026-05-14',
    l3ManagerRating: 5,
    l3Application: 5,
    l3Confidence: 5,
    l3LessSupervision: 5,
    l3SharesLearning: 4,
    l3Notes: 'Exceptional application. Has become a resource person for the team.',
    l4KPI: 'Donor Report Accuracy',
    l4Before: '80%',
    l4After: '96%',
    l4Improvement: '+16%',
    l4ROI: '510%',
    l4MetricsImproved: true,
    l4Notes: 'Donor report accuracy improved dramatically. Zero revision requests in Q1.',
    completedDate: '2026-03-11',
  },
  {
    id: 'EVAL008',
    programId: 'TR002',
    programTitle: 'Financial Management & Budgeting',
    employeeId: 'UF005',
    employeeName: 'Grace Wanjiku',
    dept: 'Procurement',
    evalDate: '2026-04-10',
    l1Rating: 4,
    l1Feedback: 'Very comprehensive. The IFMIS module was especially helpful for daily work.',
    l2PreScore: 50,
    l2PostScore: 82,
    l2CertUploaded: true,
    l2Status: 'Pass',
    l3Status: 'Pending',
    l3ManagerRating: 0,
    l3Application: 0,
    l3Confidence: 0,
    l3LessSupervision: 0,
    l3SharesLearning: 0,
    l3Notes: '',
    l4KPI: 'Budget Variance',
    l4Before: '8%',
    l4After: '8%',
    l4Improvement: 'Pending',
    l4ROI: 'Pending',
    l4MetricsImproved: false,
    l4Notes: 'Assessment pending — 60-day window not yet reached.',
    completedDate: '2026-04-09',
  },
];

export const individualDevelopmentPlans: IDP[] = [
  {
    id: 'IDP001',
    employeeId: 'UF001',
    employeeName: 'Jane Mwangi',
    dept: 'Monitoring & Evaluation',
    period: 'Q1–Q4 2026',
    managerSigned: true,
    managerName: 'Dr. Faith Mutua',
    createdDate: '2026-01-15',
    overallProgress: 45,
    status: 'Active',
    goals: [
      { id: 'G1', goal: 'Achieve Advanced level in Power BI data visualization', linkedTraining: 'Advanced Data Analysis with Power BI', targetDate: '2026-06-30', progress: 20, status: 'In Progress' },
      { id: 'G2', goal: 'Complete Leadership & Management certification', linkedTraining: 'Leadership & Management Skills', targetDate: '2026-04-30', progress: 80, status: 'In Progress' },
      { id: 'G3', goal: 'Finalize Q1 M&E report using new frameworks', linkedTraining: 'Performance Management Systems', targetDate: '2026-03-31', progress: 100, status: 'Completed' },
    ],
  },
  {
    id: 'IDP002',
    employeeId: 'UF005',
    employeeName: 'Grace Wanjiku',
    dept: 'Procurement',
    period: 'Q1–Q4 2026',
    managerSigned: true,
    managerName: 'John Mutua',
    createdDate: '2026-01-20',
    overallProgress: 60,
    status: 'Active',
    goals: [
      { id: 'G1', goal: 'Obtain KISM certification in public procurement', linkedTraining: 'Public Procurement & Asset Disposal Act Training', targetDate: '2026-06-30', progress: 70, status: 'In Progress' },
      { id: 'G2', goal: 'Master IFMIS financial reporting module', linkedTraining: 'Financial Management & Budgeting', targetDate: '2026-05-31', progress: 50, status: 'In Progress' },
    ],
  },
  {
    id: 'IDP003',
    employeeId: 'UF009',
    employeeName: 'Alice Odhiambo',
    dept: 'ICT',
    period: 'Q1–Q4 2026',
    managerSigned: false,
    managerName: 'Peter Otieno',
    createdDate: '2026-02-01',
    overallProgress: 15,
    status: 'Active',
    goals: [
      { id: 'G1', goal: 'Pass AWS Cloud Practitioner exam', linkedTraining: 'AWS Cloud Practitioner Certification', targetDate: '2026-07-31', progress: 15, status: 'In Progress' },
      { id: 'G2', goal: 'Lead ICT system migration project', linkedTraining: 'Project Management Fundamentals', targetDate: '2026-09-30', progress: 0, status: 'Not Started' },
    ],
  },
  {
    id: 'IDP004',
    employeeId: 'UF012',
    employeeName: 'Brian Omondi',
    dept: 'ICT',
    period: 'Q1–Q4 2026',
    managerSigned: true,
    managerName: 'Peter Otieno',
    createdDate: '2026-02-10',
    overallProgress: 30,
    status: 'Active',
    goals: [
      { id: 'G1', goal: 'Obtain Cisco CCNA certification', linkedTraining: 'Cisco CCNA Network Security', targetDate: '2026-06-30', progress: 30, status: 'In Progress' },
      { id: 'G2', goal: 'Implement network monitoring dashboard', linkedTraining: 'ICT Security & Data Protection', targetDate: '2026-05-31', progress: 60, status: 'In Progress' },
    ],
  },
];

export const trainingRecords: TrainingRecord[] = [
  { id: 'REC001', employeeId: 'UF002', employeeName: 'Peter Otieno', dept: 'ICT', courseName: 'ICT Security & Data Protection', provider: 'Eng. Peter Mwenda', completionDate: '2026-03-21', certStatus: 'Submitted', certUploadDate: '2026-03-25', expiryDate: '2027-03-21', daysToExpiry: 341, hoursAwarded: 16, cost: 6000, daysSinceCompletion: 26 },
  { id: 'REC002', employeeId: 'UF001', employeeName: 'Jane Mwangi', dept: 'Monitoring & Evaluation', courseName: 'Performance Management Systems', provider: 'Dr. Faith Mutua', completionDate: '2026-03-11', certStatus: 'Submitted', certUploadDate: '2026-03-14', expiryDate: '2028-03-11', daysToExpiry: 696, hoursAwarded: 14, cost: 3750, daysSinceCompletion: 36 },
  { id: 'REC003', employeeId: 'UF009', employeeName: 'Alice Odhiambo', dept: 'ICT', courseName: 'ICT Security & Data Protection', provider: 'Eng. Peter Mwenda', completionDate: '2026-03-21', certStatus: 'Submitted', certUploadDate: '2026-03-28', expiryDate: '2026-05-10', daysToExpiry: 26, hoursAwarded: 16, cost: 6000, daysSinceCompletion: 26 },
  { id: 'REC004', employeeId: 'UF012', employeeName: 'Brian Omondi', dept: 'ICT', courseName: 'ICT Security & Data Protection', provider: 'Eng. Peter Mwenda', completionDate: '2026-03-21', certStatus: 'Missing', expiryDate: '2026-04-20', daysToExpiry: 6, hoursAwarded: 16, cost: 6000, daysSinceCompletion: 26 },
  { id: 'REC005', employeeId: 'UF005', employeeName: 'Grace Wanjiku', dept: 'Procurement', courseName: 'Financial Management & Budgeting', provider: 'CPA John Kariuki', completionDate: '2026-04-09', certStatus: 'Submitted', certUploadDate: '2026-04-12', hoursAwarded: 14, cost: 8000, daysSinceCompletion: 7 },
  { id: 'REC006', employeeId: 'UF007', employeeName: 'Fatuma Hassan', dept: 'Monitoring & Evaluation', courseName: 'Performance Management Systems', provider: 'Dr. Faith Mutua', completionDate: '2026-03-11', certStatus: 'Submitted', certUploadDate: '2026-03-15', hoursAwarded: 14, cost: 3750, daysSinceCompletion: 36 },
  { id: 'REC007', employeeId: 'UF008', employeeName: 'John Mutua', dept: 'Procurement', courseName: 'Performance Management Systems', provider: 'Dr. Faith Mutua', completionDate: '2026-03-11', certStatus: 'Pending', expiryDate: '2026-04-25', daysToExpiry: 11, hoursAwarded: 14, cost: 3750, daysSinceCompletion: 36 },
  { id: 'REC008', employeeId: 'UF011', employeeName: 'Esther Njeri', dept: 'Monitoring & Evaluation', courseName: 'Performance Management Systems', provider: 'Dr. Faith Mutua', completionDate: '2026-03-11', certStatus: 'Submitted', certUploadDate: '2026-03-13', hoursAwarded: 14, cost: 3750, daysSinceCompletion: 36 },
  { id: 'REC009', employeeId: 'UF003', employeeName: 'Mary Kamau', dept: 'Corporate Communication', courseName: 'Financial Management & Budgeting', provider: 'CPA John Kariuki', completionDate: '2026-04-09', certStatus: 'Missing', hoursAwarded: 14, cost: 8000, daysSinceCompletion: 7 },
  { id: 'REC010', employeeId: 'UF010', employeeName: 'Robert Kariuki', dept: 'Corporate Communication', courseName: 'Customer Service Excellence', provider: 'Ms. Grace Njeri', completionDate: '2026-02-15', certStatus: 'Submitted', certUploadDate: '2026-02-18', expiryDate: '2027-02-15', daysToExpiry: 307, hoursAwarded: 8, cost: 6250, daysSinceCompletion: 60 },
];

export const budgetData = [
  { dept: 'Monitoring & Evaluation', planned: 120000, actual: 86500 },
  { dept: 'ICT', planned: 180000, actual: 102000 },
  { dept: 'Procurement', planned: 95000, actual: 68000 },
  { dept: 'Corporate Communication', planned: 75000, actual: 47000 },
  { dept: 'Transport', planned: 45000, actual: 28000 },
  { dept: 'Administration', planned: 60000, actual: 41000 },
];
