import { Paginated } from './Paginated';

export interface GoalUpdate {
  id: string;
  goal_id: string;
  update_description: string;
  updated_by: string;
  progress_value?: number | null;
  evidence_url?: string | null;
  evidence_file_path?: string | null;
  month?: number | null;
  year?: number | null;
  updater?: Record<string, unknown> | null;
  created_at?: Date | null;
  updated_at?: Date | null;
}

export interface Goal {
  id: string;
  name: string;
  description: string;
  scope?: string | null;
  competency_id?: string | null;
  org_unit_id?: string | null;
  assigned_to_id?: string | null;
  priority: string;
  weight: number;
  deadline: string;
  status: string;
  progress: number;
  target_value?: number | null;
  current_value?: number | null;
  measurement_unit?: string | null;
  assigned_to?: Record<string, unknown> | null;
  organisational_unit?: { id: string; name: string } | null;
  competency?: Record<string, unknown> | null;
  goal_updates?: GoalUpdate[];
  created_at?: Date | null;
  updated_at?: Date | null;
}

export interface CreateGoalPayload {
  name: string;
  description: string;
  scope?: string | null;
  competency_id?: string | null;
  org_unit_id?: string | null;
  assigned_to_id?: string | null;
  priority: string;
  weight: number;
  deadline: string;
  status: string;
  target_value?: number | null;
  current_value?: number | null;
  measurement_unit?: string | null;
}

export interface SubmitGoalUpdatePayload {
  update_description: string;
  updated_by: string;
  progress_value?: number | null;
  evidence_url?: string | null;
  evidence_file_path?: string | null;
  month: number;
  year: number;
}

export interface GoalResponse {
  data: Goal;
}

export interface GoalUpdateResponse {
  data: GoalUpdate;
}

export type PaginatedGoals = Paginated<Goal>;
export type PaginatedGoalUpdates = Paginated<GoalUpdate>;
