export type WorkflowApproverType = 'direct_supervisor' | 'position' | 'specific_user' | 'role';

export interface LeaveWorkflowStep {
  id?: string;
  workflow_id?: string;
  step_number: number;
  approver_type: WorkflowApproverType;
  approver_position_id?: string | null;
  approver_user_id?: string | null;
  approver_role?: string | null;
  can_skip?: boolean;
  auto_approve_after_days?: number | null;
  created_at?: string;
  updated_at?: string;
}

export interface LeaveWorkflow {
  id: string;
  name: string;
  description?: string | null;
  is_default: boolean;
  is_active: boolean;
  steps_count?: number;
  steps?: LeaveWorkflowStep[];
  created_at?: string;
  updated_at?: string;
  deleted_at?: string | null;
}

export interface CreateLeaveWorkflowPayload {
  name: string;
  description?: string | null;
  is_default?: boolean;
  is_active?: boolean;
  steps: LeaveWorkflowStep[];
}

export interface UpdateLeaveWorkflowPayload extends CreateLeaveWorkflowPayload {
  id: string;
}

export interface WorkflowAssignment {
  id: string;
  workflow_id: string;
  workflow_name?: string | null;
  employee_id?: string | null;
  employee?: {
    employee_id: string;
    staff_id?: string;
    firstname?: string;
    lastname?: string;
  } | null;
  employee_category_id?: string | null;
  employee_category_name?: string | null;
  position_id?: string | null;
  position_name?: string | null;
  is_active: boolean;
  created_at?: string;
  updated_at?: string;
}

export interface AssignWorkflowPayload {
  workflow_id: string;
  employee_id?: string | null;
  employee_category_id?: string | null;
  position_id?: string | null;
  is_active?: boolean;
}

export interface WorkflowActionResponse {
  message: string;
  data: LeaveWorkflow;
}

export interface WorkflowAssignmentActionResponse {
  message: string;
  data: WorkflowAssignment;
}

export interface DeleteLeaveWorkflowResponse {
  message: string;
  id?: string;
}
