// Types cho HRM Config module — mirror BE Domain.Hrm.* entities.
// Phase 10.2 G-H2 (Mig 35 — S34 schema + S35 BE CRUD wire + FE this file).

export type HrmConfigKind = 'leave-types' | 'holidays' | 'shifts' | 'ot-policies' | 'vehicles' | 'drivers'

// ========== DTOs (mirror BE DTOs HrmConfigFeatures.cs records) ==========

export type LeaveTypeDto = {
  id: string
  code: string
  name: string
  daysPerYear: number
  isPaid: boolean
  requiresAttachment: boolean
  isActive: boolean
  description: string | null
}

export type HolidayDto = {
  id: string
  year: number
  date: string  // ISO date 'YYYY-MM-DD' (DateOnly serialized)
  name: string
  isRecurring: boolean
  isPaid: boolean
  isActive: boolean
  description: string | null
}

export type ShiftPatternDto = {
  id: string
  code: string
  name: string
  startTime: string  // 'HH:mm[:ss]' (TimeOnly serialized)
  endTime: string
  breakMinutes: number
  workDays: string  // comma-separated 'Mon,Tue,Wed,Thu,Fri'
  isActive: boolean
  description: string | null
}

export type OtPolicyDto = {
  id: string
  code: string
  name: string
  multiplierWeekday: number
  multiplierWeekend: number
  multiplierHoliday: number
  maxHoursPerDay: number
  maxHoursPerMonth: number
  maxHoursPerYear: number
  isActive: boolean
  description: string | null
}

// Phase 11 P11-C (S51) — danh mục xe công + tài xế, dùng khi đăng ký đặt xe.
export type VehicleDto = {
  id: string
  code: string
  name: string
  licensePlate: string
  seatCount: number | null
  isActive: boolean
  description: string | null
}

export type DriverDto = {
  id: string
  code: string
  name: string
  phoneNumber: string | null
  licenseNumber: string | null
  licenseClass: string | null
  isActive: boolean
  description: string | null
}

// ========== Create/Update Input Commands (mirror BE record Command shape) ==========

export type CreateLeaveTypeInput = {
  code: string
  name: string
  daysPerYear: number
  isPaid: boolean
  requiresAttachment: boolean
  description: string | null
}

export type UpdateLeaveTypeInput = CreateLeaveTypeInput & { id: string; isActive: boolean }

export type CreateHolidayInput = {
  year: number
  date: string
  name: string
  isRecurring: boolean
  isPaid: boolean
  description: string | null
}

export type UpdateHolidayInput = CreateHolidayInput & { id: string; isActive: boolean }

export type CreateShiftInput = {
  code: string
  name: string
  startTime: string
  endTime: string
  breakMinutes: number
  workDays: string
  description: string | null
}

export type UpdateShiftInput = CreateShiftInput & { id: string; isActive: boolean }

export type CreateOtPolicyInput = {
  code: string
  name: string
  multiplierWeekday: number
  multiplierWeekend: number
  multiplierHoliday: number
  maxHoursPerDay: number
  maxHoursPerMonth: number
  maxHoursPerYear: number
  description: string | null
}

export type UpdateOtPolicyInput = CreateOtPolicyInput & { id: string; isActive: boolean }

export type CreateVehicleInput = {
  code: string
  name: string
  licensePlate: string
  seatCount: number | null
  description: string | null
}

export type UpdateVehicleInput = CreateVehicleInput & { id: string; isActive: boolean }

export type CreateDriverInput = {
  code: string
  name: string
  phoneNumber: string | null
  licenseNumber: string | null
  licenseClass: string | null
  description: string | null
}

export type UpdateDriverInput = CreateDriverInput & { id: string; isActive: boolean }
