import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb";
import Container from "@/components/Forms/Container";
import ReactTable from "@/components/ReactTable/ReactTable";
import { cadastrarMotivoReagendamento } from "@/requests/CRUD/MotivosReagendamento/cadastrarMotivoReagendamento";
import { editarMotivoReagendamento } from "@/requests/CRUD/MotivosReagendamento/editarMotivoReagendamento";
import { listarMotivosReagendamento } from "@/requests/CRUD/MotivosReagendamento/listarMotivosReagendamento";
import FormMotivoReagendamento from "./FormMotivoReagendamento";

const ConsultaMotivosReagendamento = () => {
  const columns = [
    {
      header: "ID",
      accessorKey: "id_motivo_reagendamento",
    },
    {
      header: "Status",
      accessorKey: "status_motivo_reagendamento",
    },
    {
      header: "Motivo",
      accessorKey: "motivo_reagendamento",
    },
  ];

  function formatarValores(data: any[]) {
    return data.map((e) => {
      return e;
    });
  }
  return (
    <>
      <Breadcrumb pageName="Motivos de Reagendamento" />
      <Container>
        <ReactTable
          columns={columns}
          listFunction={listarMotivosReagendamento}
          formatFunction={formatarValores}
          idCol="id_motivo_reagendamento"
          isActiveCol="status_motivo_reagendamento"
          canEdit
          canDesactive
          createFunction={cadastrarMotivoReagendamento}
          editFunction={editarMotivoReagendamento}
          Form={FormMotivoReagendamento}
          pageName="Motivos de Reagendamento"
        />
      </Container>
    </>
  );
};

export default ConsultaMotivosReagendamento;
