export type Department = {
  id: string
  name: string
  createdAt: Date
  updatedAt: Date
}

export type SubDepartment = {
  id: string
  name: string
  departmentId: string
  createdAt: Date
  updatedAt: Date
}

export type Branch = {
  id: string
  name: string
  location?: string | null
  createdAt: Date
  updatedAt: Date
}

export type Shift = {
  id: string
  name: string
  createdAt: Date
  updatedAt: Date
}

export type EmployeeShift = {
  id: string
  employeeId: string
  shiftId: string
  effectiveFrom?: Date | null
  createdAt: Date
  updatedAt: Date
  shift?: Shift
}

export type EmployeeDocument = {
  id: string
  employeeId: string
  civilIdExpiry?: Date | null
  passportNumber?: string | null
  passportExpiry?: Date | null
  doctorLicenseId?: string | null
  doctorLicenseExpiry?: Date | null
  createdAt: Date
  updatedAt: Date
}

export type SalaryComponent = {
  id: string
  employeeId: string
  category: string
  amount: number
  createdAt: Date
  updatedAt: Date
}

export type LeaveType = {
  id: string
  name: string
  createdAt: Date
  updatedAt: Date
}

export type EmployeeLeaveAllowance = {
  id: string
  employeeId: string
  leaveTypeId: string
  days: number
  createdAt: Date
  updatedAt: Date
  leaveType?: LeaveType
}

export type LeaveAllowance = {
  id: string
  employeeId: string
  annualDays: number
  sickDays: number
  createdAt: Date
  updatedAt: Date
}

export type Employee = {
  id: string
  fullName: string
  dob?: Date | null
  joiningDate?: Date | null
  email?: string | null
  phone?: string | null
  civilId?: string | null
  nationality?: string | null
  address?: string | null
  position?: string | null
  description?: string | null
  userId?: string | null
  departmentId?: string | null
  subDepartmentId?: string | null
  branchId?: string | null
  avatarUrl?: string | null
  reportingManagerId?: string | null
  zktecoId?: string | null
  createdAt: Date
  updatedAt: Date
}

export type EmployeeWithRelations = Employee & {
  department?: Department | null
  subDepartment?: SubDepartment | null
  branch?: Branch | null
  reportingManager?: Employee | null
  shifts: EmployeeShift[]
  document?: EmployeeDocument | null
  salaryComponents: SalaryComponent[]
  leaveAllowance?: LeaveAllowance | null
  leaveAllowances: EmployeeLeaveAllowance[]
}

export type EmployeeListItem = {
  id: string
  fullName: string
  email?: string | null
  phone?: string | null
  departmentName?: string | null
  branchName?: string | null
  position?: string | null
  joiningDate?: Date | null
}
