export type RequisitionStatus = 'Draft' | 'Pending Dept Head' | 'Pending HR' | 'Pending Finance' | 'Approved' | 'Rejected' | 'On Hold';
export type EmploymentType = 'Full-time' | 'Part-time' | 'Contract' | 'Internship';
export type Urgency = 'High' | 'Medium' | 'Low';
export type CandidateStatus =
  | 'New Application' | 'Screening' | 'Shortlisted' | 'Interview Scheduled'
  | 'Technical Assessment' | 'Final Interview' | 'Offer Extended' | 'Offer Accepted'
  | 'Hired' | 'Rejected' | 'Withdrawn';

export interface JobRequisition {
  id: string;
  positionTitle: string;
  department: string;
  openings: number;
  employmentType: EmploymentType;
  urgency: Urgency;
  justification: 'Backfill' | 'New Role';
  budgetRequired: boolean;
  status: RequisitionStatus;
  requester: string;
  createdDate: string;
  approvedDate?: string;
  jobPostingId?: string;
  targetSalaryMin?: number;
  targetSalaryMax?: number;
  description?: string;
}

export interface JobPosting {
  id: string;
  requisitionId: string;
  title: string;
  department: string;
  location: string;
  employmentType: EmploymentType;
  description: string;
  requirements: string;
  postedDate: string;
  expiryDate: string;
  status: 'Active' | 'Closed' | 'Draft' | 'Paused';
  publishChannels: string[];
  applicationCount: number;
  salaryMin?: number;
  salaryMax?: number;
}

export interface Candidate {
  id: string;
  jobPostingId: string;
  jobTitle: string;
  name: string;
  email: string;
  phone: string;
  location: string;
  source: 'LinkedIn' | 'Indeed' | 'Career Site' | 'Referral' | 'Agency' | 'Internal';
  status: CandidateStatus;
  appliedDate: string;
  yearsExperience: number;
  skills: string[];
  currentRole?: string;
  currentCompany?: string;
  expectedSalary?: number;
  education?: string;
  resumeUrl?: string;
  coverLetterUrl?: string;
  overallRating?: number;
  interviewCount?: number;
  referredBy?: string;
  notes?: string;
  talentPool?: boolean;
  talentPoolTags?: string[];
}

export interface Interview {
  id: string;
  candidateId: string;
  candidateName: string;
  jobTitle: string;
  scheduledDate: string;
  scheduledTime: string;
  mode: 'In-person' | 'Video Call' | 'Phone';
  meetingLink?: string;
  location?: string;
  interviewers: string[];
  round: string;
  status: 'Scheduled' | 'Completed' | 'Cancelled' | 'No Show';
  feedback?: {
    technical: number;
    communication: number;
    culturalFit: number;
    overall: number;
    recommendation: 'Hire' | 'No Hire' | 'Maybe';
    notes: string;
  };
}

export interface Offer {
  id: string;
  candidateId: string;
  candidateName: string;
  jobTitle: string;
  department: string;
  basicSalary: number;
  housingAllowance: number;
  transportAllowance: number;
  otherAllowances: number;
  startDate: string;
  offerDate: string;
  expiryDate: string;
  status: 'Draft' | 'Pending Approval' | 'Approved' | 'Extended' | 'Accepted' | 'Declined' | 'Expired';
  approvalStage?: string;
  insurance: boolean;
  bonusPercent: number;
  annualLeave: number;
  signedDate?: string;
}

export const departments = ['Human Resources', 'Finance', 'ICT', 'Operations', 'Legal', 'Audit', 'Communications', 'Programmes'];

export const requisitions: JobRequisition[] = [
  { id: 'REQ-2026-001', positionTitle: 'Senior Software Engineer', department: 'ICT', openings: 2, employmentType: 'Full-time', urgency: 'High', justification: 'New Role', budgetRequired: true, status: 'Approved', requester: 'David Mwangi', createdDate: '2026-03-01', approvedDate: '2026-03-10', jobPostingId: 'JP-001', targetSalaryMin: 180000, targetSalaryMax: 250000, description: 'We need two Senior Software Engineers to lead our digital transformation initiative.' },
  { id: 'REQ-2026-002', positionTitle: 'Finance Manager', department: 'Finance', openings: 1, employmentType: 'Full-time', urgency: 'High', justification: 'Backfill', budgetRequired: true, status: 'Approved', requester: 'Jane Wambui', createdDate: '2026-03-05', approvedDate: '2026-03-12', jobPostingId: 'JP-002', targetSalaryMin: 200000, targetSalaryMax: 280000 },
  { id: 'REQ-2026-003', positionTitle: 'Programmes Officer', department: 'Programmes', openings: 3, employmentType: 'Contract', urgency: 'Medium', justification: 'New Role', budgetRequired: false, status: 'Pending HR', requester: 'Alice Kamau', createdDate: '2026-03-15', targetSalaryMin: 80000, targetSalaryMax: 120000 },
  { id: 'REQ-2026-004', positionTitle: 'Legal Officer', department: 'Legal', openings: 1, employmentType: 'Full-time', urgency: 'Medium', justification: 'Backfill', budgetRequired: false, status: 'Pending Dept Head', requester: 'Samuel Otieno', createdDate: '2026-03-20' },
  { id: 'REQ-2026-005', positionTitle: 'Communications Intern', department: 'Communications', openings: 2, employmentType: 'Internship', urgency: 'Low', justification: 'New Role', budgetRequired: false, status: 'Draft', requester: 'Mary Njeri', createdDate: '2026-04-01' },
];

export const jobPostings: JobPosting[] = [
  { id: 'JP-001', requisitionId: 'REQ-2026-001', title: 'Senior Software Engineer', department: 'ICT', location: 'Nairobi, Kenya', employmentType: 'Full-time', description: 'Lead development of our digital platforms and mentor junior engineers. Work on cutting-edge fintech solutions that impact millions of Kenyans.', requirements: 'BSc Computer Science or related field. 5+ years experience in software development. Proficiency in React, Node.js, Python. Experience with cloud platforms (AWS/GCP). Strong problem-solving skills.', postedDate: '2026-03-11', expiryDate: '2026-04-30', status: 'Active', publishChannels: ['Internal', 'LinkedIn', 'Indeed'], applicationCount: 47, salaryMin: 180000, salaryMax: 250000 },
  { id: 'JP-002', requisitionId: 'REQ-2026-002', title: 'Finance Manager', department: 'Finance', location: 'Nairobi, Kenya', employmentType: 'Full-time', description: 'Oversee all financial operations, budgeting, forecasting and financial reporting for Uwezo Fund.', requirements: 'CPA(K) or ACCA qualification. 7+ years financial management experience. Strong knowledge of IFRS and Kenyan tax laws. Experience in NGO/government financial management.', postedDate: '2026-03-13', expiryDate: '2026-04-15', status: 'Active', publishChannels: ['Internal', 'LinkedIn', 'Career Site'], applicationCount: 31, salaryMin: 200000, salaryMax: 280000 },
  { id: 'JP-003', requisitionId: 'REQ-2026-001', title: 'IT Support Technician', department: 'ICT', location: 'Nairobi, Kenya', employmentType: 'Full-time', description: 'Provide technical support to all staff and maintain IT infrastructure.', requirements: 'Diploma in IT or related field. 2+ years IT support experience. Knowledge of networking, hardware troubleshooting.', postedDate: '2026-02-01', expiryDate: '2026-03-15', status: 'Closed', publishChannels: ['Internal', 'Career Site'], applicationCount: 89, salaryMin: 50000, salaryMax: 80000 },
];

export const candidates: Candidate[] = [
  { id: 'CAND-001', jobPostingId: 'JP-001', jobTitle: 'Senior Software Engineer', name: 'Brian Kipchoge', email: 'brian.kipchoge@email.com', phone: '+254 712 345 678', location: 'Nairobi', source: 'LinkedIn', status: 'Final Interview', appliedDate: '2026-03-14', yearsExperience: 6, skills: ['React', 'Node.js', 'Python', 'AWS', 'PostgreSQL'], currentRole: 'Software Engineer', currentCompany: 'Safaricom', expectedSalary: 220000, education: 'BSc Computer Science, University of Nairobi', overallRating: 4.2, interviewCount: 2 },
  { id: 'CAND-002', jobPostingId: 'JP-001', jobTitle: 'Senior Software Engineer', name: 'Grace Mwangi', email: 'grace.mwangi@email.com', phone: '+254 723 456 789', location: 'Nairobi', source: 'Career Site', status: 'Technical Assessment', appliedDate: '2026-03-15', yearsExperience: 5, skills: ['React', 'TypeScript', 'Docker', 'Kubernetes'], currentRole: 'Frontend Engineer', currentCompany: 'KCB Bank', expectedSalary: 200000, education: 'BSc Software Engineering, USIU', overallRating: 3.8, interviewCount: 1 },
  { id: 'CAND-003', jobPostingId: 'JP-002', jobTitle: 'Finance Manager', name: 'Peter Odhiambo', email: 'peter.odhiambo@email.com', phone: '+254 734 567 890', location: 'Nairobi', source: 'Indeed', status: 'Offer Extended', appliedDate: '2026-03-16', yearsExperience: 9, skills: ['IFRS', 'Excel', 'SAP', 'Budgeting', 'Tax Compliance'], currentRole: 'Senior Finance Officer', currentCompany: 'World Bank', expectedSalary: 260000, education: 'CPA(K), ACCA', overallRating: 4.6, interviewCount: 3 },
  { id: 'CAND-004', jobPostingId: 'JP-001', jobTitle: 'Senior Software Engineer', name: 'Amina Hassan', email: 'amina.hassan@email.com', phone: '+254 745 678 901', location: 'Mombasa', source: 'Referral', status: 'Shortlisted', appliedDate: '2026-03-18', yearsExperience: 7, skills: ['Python', 'Django', 'PostgreSQL', 'Redis', 'GCP'], currentRole: 'Backend Engineer', currentCompany: 'Andela', expectedSalary: 230000, education: 'BSc Computer Science, Moi University', referredBy: 'John Kamau (ICT Dept)', overallRating: 4.0, interviewCount: 1 },
  { id: 'CAND-005', jobPostingId: 'JP-002', jobTitle: 'Finance Manager', name: 'Ruth Wanjiku', email: 'ruth.wanjiku@email.com', phone: '+254 756 789 012', location: 'Nairobi', source: 'LinkedIn', status: 'Screening', appliedDate: '2026-03-19', yearsExperience: 8, skills: ['Financial Reporting', 'IFRS', 'Oracle Financials', 'Team Leadership'], currentRole: 'Finance Manager', currentCompany: 'KPLC', expectedSalary: 270000, education: 'MBA Finance, Strathmore University; CPA(K)', overallRating: 3.5, interviewCount: 0 },
  { id: 'CAND-006', jobPostingId: 'JP-001', jobTitle: 'Senior Software Engineer', name: 'Kevin Otieno', email: 'kevin.otieno@email.com', phone: '+254 767 890 123', location: 'Nairobi', source: 'Agency', status: 'Rejected', appliedDate: '2026-03-20', yearsExperience: 3, skills: ['PHP', 'MySQL', 'JavaScript'], currentRole: 'Junior Developer', currentCompany: 'StartupKE', expectedSalary: 150000, education: 'Diploma in IT', overallRating: 2.1, interviewCount: 1 },
  { id: 'CAND-007', jobPostingId: 'JP-002', jobTitle: 'Finance Manager', name: 'Sarah Njoroge', email: 'sarah.njoroge@email.com', phone: '+254 778 901 234', location: 'Nairobi', source: 'Internal', status: 'Offer Accepted', appliedDate: '2026-03-10', yearsExperience: 10, skills: ['Strategic Finance', 'IFRS', 'Donor Reporting', 'Audit'], currentRole: 'Senior Finance Manager', currentCompany: 'Uwezo Fund (Internal)', expectedSalary: 275000, education: 'CPA(K), MBA', overallRating: 4.8, interviewCount: 3 },
  { id: 'CAND-008', jobPostingId: 'JP-001', jobTitle: 'Senior Software Engineer', name: 'Daniel Kimani', email: 'daniel.kimani@email.com', phone: '+254 789 012 345', location: 'Nairobi', source: 'LinkedIn', status: 'New Application', appliedDate: '2026-04-02', yearsExperience: 5, skills: ['Java', 'Spring Boot', 'Microservices', 'AWS'], currentRole: 'Software Engineer', currentCompany: 'Equity Bank', expectedSalary: 210000, education: 'BSc Computer Science', overallRating: undefined, interviewCount: 0 },
  { id: 'CAND-009', jobPostingId: 'JP-002', jobTitle: 'Finance Manager', name: 'James Maina', email: 'james.maina@email.com', phone: '+254 790 123 456', location: 'Nairobi', source: 'Career Site', status: 'Withdrawn', appliedDate: '2026-03-22', yearsExperience: 7, skills: ['Financial Analysis', 'Excel', 'Budgeting'], currentRole: 'Finance Analyst', currentCompany: 'NSSF', expectedSalary: 220000, education: 'BCom Finance, UoN', overallRating: undefined, interviewCount: 0 },
  { id: 'CAND-010', jobPostingId: 'JP-001', jobTitle: 'Senior Software Engineer', name: 'Fatuma Ali', email: 'fatuma.ali@email.com', phone: '+254 701 234 567', location: 'Nairobi', source: 'LinkedIn', status: 'Interview Scheduled', appliedDate: '2026-03-25', yearsExperience: 6, skills: ['React', 'Vue.js', 'Node.js', 'MongoDB'], currentRole: 'Full-stack Developer', currentCompany: 'iHub', expectedSalary: 215000, education: 'BSc IT, KCA University', overallRating: 3.9, interviewCount: 1, talentPool: true, talentPoolTags: ['Frontend Expert', 'React Specialist'] },
];

export const interviews: Interview[] = [
  { id: 'INT-001', candidateId: 'CAND-001', candidateName: 'Brian Kipchoge', jobTitle: 'Senior Software Engineer', scheduledDate: '2026-04-16', scheduledTime: '10:00 AM', mode: 'In-person', location: 'Uwezo Fund HQ, 5th Floor Boardroom', interviewers: ['David Mwangi', 'Tech Lead - ICT'], round: 'Final Interview', status: 'Scheduled' },
  { id: 'INT-002', candidateId: 'CAND-004', candidateName: 'Amina Hassan', jobTitle: 'Senior Software Engineer', scheduledDate: '2026-04-17', scheduledTime: '2:00 PM', mode: 'Video Call', meetingLink: 'https://zoom.us/j/123456789', interviewers: ['David Mwangi', 'Jane Wambui'], round: 'Technical Interview', status: 'Scheduled' },
  { id: 'INT-003', candidateId: 'CAND-010', candidateName: 'Fatuma Ali', jobTitle: 'Senior Software Engineer', scheduledDate: '2026-04-18', scheduledTime: '11:00 AM', mode: 'Video Call', meetingLink: 'https://teams.microsoft.com/meet/abc123', interviewers: ['David Mwangi'], round: 'First Interview', status: 'Scheduled' },
  { id: 'INT-004', candidateId: 'CAND-003', candidateName: 'Peter Odhiambo', jobTitle: 'Finance Manager', scheduledDate: '2026-04-05', scheduledTime: '9:00 AM', mode: 'In-person', location: 'Boardroom A', interviewers: ['Jane Wambui', 'CEO Office', 'HR Director'], round: 'Final Interview', status: 'Completed', feedback: { technical: 5, communication: 4, culturalFit: 5, overall: 5, recommendation: 'Hire', notes: 'Excellent candidate with deep NGO finance experience. Very strong on IFRS and donor reporting. Highly recommended.' } },
  { id: 'INT-005', candidateId: 'CAND-002', candidateName: 'Grace Mwangi', jobTitle: 'Senior Software Engineer', scheduledDate: '2026-04-08', scheduledTime: '3:00 PM', mode: 'Video Call', meetingLink: 'https://zoom.us/j/987654321', interviewers: ['David Mwangi', 'Senior Dev'], round: 'Technical Interview', status: 'Completed', feedback: { technical: 4, communication: 4, culturalFit: 4, overall: 4, recommendation: 'Maybe', notes: 'Good frontend skills, needs more backend exposure. Could work well with mentoring.' } },
];

export const offers: Offer[] = [
  { id: 'OFR-001', candidateId: 'CAND-003', candidateName: 'Peter Odhiambo', jobTitle: 'Finance Manager', department: 'Finance', basicSalary: 200000, housingAllowance: 40000, transportAllowance: 15000, otherAllowances: 10000, startDate: '2026-05-01', offerDate: '2026-04-08', expiryDate: '2026-04-15', status: 'Extended', approvalStage: 'Approved', insurance: true, bonusPercent: 15, annualLeave: 21 },
  { id: 'OFR-002', candidateId: 'CAND-007', candidateName: 'Sarah Njoroge', jobTitle: 'Finance Manager', department: 'Finance', basicSalary: 220000, housingAllowance: 45000, transportAllowance: 15000, otherAllowances: 15000, startDate: '2026-04-14', offerDate: '2026-03-25', expiryDate: '2026-04-01', status: 'Accepted', approvalStage: 'Fully Approved', insurance: true, bonusPercent: 20, annualLeave: 21, signedDate: '2026-03-28' },
];

export const talentPool: Candidate[] = [
  { id: 'TP-001', jobPostingId: '', jobTitle: 'Data Analyst', name: 'Linda Achieng', email: 'linda.achieng@email.com', phone: '+254 711 222 333', location: 'Nairobi', source: 'LinkedIn', status: 'Rejected', appliedDate: '2026-01-10', yearsExperience: 4, skills: ['Python', 'R', 'Tableau', 'SQL', 'Power BI'], currentRole: 'Data Analyst', currentCompany: 'Equity Bank', expectedSalary: 130000, education: 'BSc Statistics, UoN', talentPool: true, talentPoolTags: ['Data Analytics', 'Visualisation'] },
  { id: 'TP-002', jobPostingId: '', jobTitle: 'HR Business Partner', name: 'Moses Kiprop', email: 'moses.kiprop@email.com', phone: '+254 722 333 444', location: 'Nairobi', source: 'Career Site', status: 'Rejected', appliedDate: '2025-11-15', yearsExperience: 6, skills: ['Talent Management', 'Labour Law', 'HR Analytics', 'HRIS'], currentRole: 'HR Officer', currentCompany: 'KEMSA', expectedSalary: 160000, education: 'BA HR Management, Daystar University', talentPool: true, talentPoolTags: ['HR Generalist', 'Labour Law'] },
];

export const pipelineStages: CandidateStatus[] = [
  'New Application', 'Screening', 'Shortlisted', 'Interview Scheduled',
  'Technical Assessment', 'Final Interview', 'Offer Extended', 'Offer Accepted', 'Hired'
];

export const statusColors: Record<CandidateStatus, string> = {
  'New Application': 'bg-blue-100 text-blue-700',
  'Screening': 'bg-purple-100 text-purple-700',
  'Shortlisted': 'bg-indigo-100 text-indigo-700',
  'Interview Scheduled': 'bg-yellow-100 text-yellow-700',
  'Technical Assessment': 'bg-orange-100 text-orange-700',
  'Final Interview': 'bg-pink-100 text-pink-700',
  'Offer Extended': 'bg-teal-100 text-teal-700',
  'Offer Accepted': 'bg-green-100 text-green-700',
  'Hired': 'bg-green-200 text-green-800',
  'Rejected': 'bg-red-100 text-red-700',
  'Withdrawn': 'bg-gray-100 text-gray-600',
};

export const urgencyColors: Record<Urgency, string> = {
  High: 'bg-red-100 text-red-700',
  Medium: 'bg-yellow-100 text-yellow-700',
  Low: 'bg-green-100 text-green-700',
};

export const sourceColors: Record<string, string> = {
  LinkedIn: 'bg-blue-100 text-blue-700',
  Indeed: 'bg-indigo-100 text-indigo-700',
  'Career Site': 'bg-purple-100 text-purple-700',
  Referral: 'bg-green-100 text-green-700',
  Agency: 'bg-orange-100 text-orange-700',
  Internal: 'bg-pink-100 text-pink-700',
};
