import {
  CircleCheckIcon,
  CircleIcon,
  CircleOffIcon,
  CircleXIcon,
  TimerIcon,
  type LucideIcon
} from 'lucide-react'

// This type is used to define the shape of our data.
// You can use a Zod schema here if you want.
type Course = {
  id: string
  name: string
}

export type Enrollment = {
  id: string
  name: string
  course: Course
  status: string
  progress: string
  created_at: string
}

export const statuses: Record<
  string,
  { icon: LucideIcon; color?: string; label: string }
> = {
  PENDING: {
    icon: CircleIcon,
    label: 'Não iniciado'
  },
  IN_PROGRESS: {
    icon: TimerIcon,
    color: 'text-blue-400 [&_svg]:text-blue-500',
    label: 'Em andamento'
  },
  COMPLETED: {
    icon: CircleCheckIcon,
    color: 'text-green-400 [&_svg]:text-background [&_svg]:fill-green-500',
    label: 'Concluído'
  },
  FAILED: {
    icon: CircleXIcon,
    color: 'text-red-400 [&_svg]:text-red-500',
    label: 'Reprovado'
  },
  CANCELED: {
    icon: CircleOffIcon,
    color: 'text-orange-400 [&_svg]:text-orange-500',
    label: 'Cancelado'
  }
}

export const labels: Record<string, string> = {
  PENDING: 'Não iniciado',
  IN_PROGRESS: 'Em andamento',
  COMPLETED: 'Concluído',
  FAILED: 'Reprovado',
  CANCELED: 'Cancelado'
}

export const sortings: Record<string, string> = {
  created_at: 'Cadastrado em',
  started_at: 'Iniciado em',
  completed_at: 'Concluído em',
  failed_at: 'Reprovado em',
  canceled_at: 'Cancelado em'
}

export const headers = {
  id: 'ID',
  'user.name': 'Nome',
  'user.email': 'Email',
  'user.cpf': 'CPF',
  'course.name': 'Curso',
  status: 'Status',
  progress: 'Progresso',
  created_at: 'Cadastrado em',
  started_at: 'Iniciado em',
  completed_at: 'Concluído em',
  failed_at: 'Reprovado em',
  canceled_at: 'Cancelado em'
}
