export type LeaveRequest = {
  id: string
  employeeId: string
  leaveTypeId: string
  startDate: Date
  endDate: Date
  duration: number
  reason?: string | null
  status: "pending" | "approved" | "rejected"
  approvedById?: string | null
  approvedAt?: Date | null
  rejectionReason?: string | null
  createdAt: Date
  updatedAt: Date
}

export type LeaveRequestWithRelations = LeaveRequest & {
  employee: {
    id: string
    fullName: string
    email?: string | null
  }
  leaveType: {
    id: string
    name: string
  }
  approvedBy?: {
    id: string
    name: string
  } | null
}

export type LeaveApprovalSummary = {
  approverName: string
  role: string
  status: "pending" | "approved" | "rejected"
  reason?: string | null
  actedAt?: string | null
}

export type LeaveRequestListItem = {
  id: string
  employeeName: string
  leaveTypeName: string
  startDate: string  
  endDate: string  
  duration: number
  status: "pending" | "approved" | "rejected"
  createdAt: string 
  branchName: string | null
  departmentName: string | null
  /** Approval progress for multi-step workflow */
  approvalTotal: number
  approvalApproved: number
  approvalRejected: number
  approvalPending: number
  /** Current user's approval row, if they are an approver */
  myApprovalStatus: "pending" | "approved" | "rejected" | null
  approvals: LeaveApprovalSummary[]
}
