import { Badge } from "@repo/shadcn/badge";

import { ColumnDef } from '@tanstack/react-table';
import { CellAction } from './cell-action';
import { SurveyTable } from '@/feactures/surveys/schemas/survey';

export const columns: ColumnDef<SurveyTable>[] = [
  {
    accessorKey: 'title',
    header: 'Título',
  },
  {
    accessorKey: "published",
    header: "Estado",
    cell: ({ row }) => {
      const published = row.getValue("published");
        return (
          <Badge variant={published == 'Publicada' ? "default" : "secondary"}>
            {published == 'Publicada' ? 'Publicada' : 'Borrador'}
          </Badge>
        )
    },
  },
  {
    id: 'actions',
    header: 'Acciones',
    cell: ({ row }) => <CellAction data={row.original} />,
  },
];
