export interface UserOut {
  id: string
  first_name: string
  last_name: string
  email: string
  role: string
  company_id: string
}

export type AbsenceCategory =
  | 'vacation'
  | 'sick'
  | 'overtime_comp'
  | 'training'
  | 'business_trip'
  | 'other'

export interface AbsenceTypeOut {
  id: string
  name: string
  color: string
  category: AbsenceCategory
  requires_approval: boolean
  deducts_vacation: boolean
  affects_overtime_balance: boolean
  requires_certificate: boolean
  certificate_after_days: number
  is_paid: boolean
  max_days_per_year: number | null
  is_active: boolean
}

export interface OvertimeBalanceOut {
  total_hours: number
  taken_hours: number
  available_hours: number
}

export interface AbsenceOut {
  id: string
  user_id: string
  type_id: string
  start_date: string
  end_date: string
  half_day_start: boolean
  half_day_end: boolean
  working_days: number
  status: string
  approved_by: string | null
  first_approved_by: string | null
  substitute_id: string | null
  note: string | null
  correction_note: string | null
  rejection_reason: string | null
  certificate_required_by: string | null
  certificate_received_at: string | null
  created_at: string
}

export interface AbsenceComment {
  id: string
  absence_id: string
  author_id: string | null
  author_name: string | null
  body: string
  is_system: boolean
  created_at: string
}

export interface SickStatsRow {
  user_id: string
  user_name: string
  personnel_number: string | null
  episodes: number
  total_days: number
  bradford_factor: number
  certificates_overdue: number
}

export interface AbsenceListResponse {
  total: number
  items: AbsenceOut[]
}

export interface UserListItem {
  id: string
  full_name: string
  email?: string
}

export interface VacationBalanceOut {
  id: string
  user_id: string
  year: number
  entitled_days: number
  special_days: number
  carried_over: number
  used_days: number
  total_days: number
  remaining_days: number
  available_days: number
  pending_days: number
  carried_over_expires_at: string | null
  carried_over_expired: boolean
}

export interface AbsenceSpan {
  id: string
  userId: string
  userName: string
  typeName: string
  color: string
  start: Date
  end: Date
  status: string
  isHalfStart: boolean
  isHalfEnd: boolean
}
