import { GridColDef } from "@mui/x-data-grid";
import DataGrid from "@kitUI/datagrid";
import { Typography } from "@mui/material";
import { useCombinedPrivileges } from "@root/hooks/useCombinedPrivileges.hook";
import { usePrivilegeStore } from "@root/stores/privilegesStore";

const columns: GridColDef[] = [
  { field: "id", headerName: "id", width: 150 },
  { field: "name", headerName: "Привелегия", width: 150 },
  { field: "description", headerName: "Описание", width: 550 }, //инфо из гитлаба.
  { field: "type", headerName: "Тип", width: 150 },
  { field: "price", headerName: "Стоимость", width: 100 },
];

export default function Privileges() {
  const privileges = usePrivilegeStore((state) => state.privileges);
  // const { mergedPrivileges } = useCombinedPrivileges();
  const privilegesGridData = privileges
  .filter(privilege => (
    !privilege.isDeleted
  ))
  .map((privilege) => ({
    id: privilege.privilegeId,
    name: privilege.name,
    description: privilege.description,
    type: privilege.type,
    price: privilege.price,
  }));

  return (
    <DataGrid
        rows={privilegesGridData}
        columns={columns}
      />
  );
}
