export interface EmployeeReportEmployee {
  id: string;
  name: string;
  staff_id: string | null;
  department: string | null;
  position: string | null;
}

export interface EmployeeReportCycle {
  id: string;
  name: string;
  start_date: string | null;
  end_date: string | null;
}

export interface AppraisalRatingItem {
  ratable_type: string;
  ratable_name: string;
  self_rating: number | null;
  manager_rating: number | null;
  final_rating: number | null;
  weight: number | null;
  weighted_score: number | null;
}

export interface EmployeeReportAppraisal {
  status: string;
  overall_score: number | null;
  overall_grade: string | null;
  employee_comments: string | null;
  manager_comments: string | null;
  hr_comments: string | null;
  ratings: AppraisalRatingItem[];
}

export interface EmployeeReportGoalItem {
  id: string;
  title: string;
  status: string;
  progress: number;
  deadline: string | null;
  weight: number | null;
}

export interface EmployeeReportGoals {
  total: number;
  completed: number;
  avg_progress: number;
  items: EmployeeReportGoalItem[];
}

export interface EmployeeReportData {
  employee: EmployeeReportEmployee;
  cycle: EmployeeReportCycle;
  appraisal: EmployeeReportAppraisal | null;
  goals: EmployeeReportGoals;
  check_ins_completed: number;
  coaching_sessions: number;
}

export interface TeamReportMember {
  employee_id: string;
  name: string;
  status: string;
  overall_score: number | null;
  overall_grade: string | null;
}

export interface TeamReportData {
  cycle: { id: string; name: string };
  team_size: number;
  completion_rate: number;
  avg_score: number;
  grade_distribution: Record<string, number>;
  members: TeamReportMember[];
  goals_summary: {
    total: number;
    completed: number;
    avg_progress: number;
  };
}

export interface DepartmentReportData {
  department_id: string;
  cycle: { id: string; name: string };
  total_employees: number;
  appraisal_summary: {
    total: number;
    completed: number;
    avg_score: number;
    grade_distribution: Record<string, number>;
  };
  goals_summary: {
    total: number;
    completed: number;
    avg_progress: number;
  };
  pip_summary: {
    active: number;
    completed: number;
  };
}

export interface DepartmentComparisonItem {
  department_id: string;
  avg_score: number;
  count: number;
}

export interface ScoreDistributionItem {
  range: string;
  count: number;
}

export interface OrganizationReportData {
  cycle: { id: string; name: string };
  overall: {
    total_submissions: number;
    completed: number;
    completion_rate: number;
    avg_score: number;
  };
  grade_distribution: Record<string, number>;
  score_distribution: ScoreDistributionItem[];
  department_comparison: DepartmentComparisonItem[];
  goals: {
    total: number;
    completed: number;
    avg_progress: number;
  };
}

export interface TrendCycleItem {
  cycle_id: string;
  cycle_name: string;
  start_date: string | null;
  overall_score: number | null;
  overall_grade: string | null;
  goals_total: number;
  goals_completed: number;
  avg_goal_progress: number;
}

export interface TrendReportData {
  employee_id: string;
  cycles: TrendCycleItem[];
}

export interface NineBoxEmployee {
  id: string;
  name: string;
  score: number;
  goal_progress: number;
  grade: string | null;
}

export interface NineBoxCell {
  label: string;
  performance: string;
  potential: string;
  employees: NineBoxEmployee[];
}

export interface NineBoxGridData {
  cycle_id: string;
  department_id: string | null;
  total_employees: number;
  grid: Record<string, NineBoxCell>;
}
