import * as React from "react";
import { GridColDef } from "@mui/x-data-grid";
import DataGrid from "@kitUI/datagrid";
import { usePrivilegeStore } from "@stores/privileges";


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

export default function PrivilegesDG() {
    const privileges = usePrivilegeStore(state => state.privileges);

    const privilegesGridData = privileges.map(privilege => ({
        id: privilege.privilegeId,
        name: privilege.name,
        description: privilege.description,
        type: privilege.type,
        price: privilege.pricePerUnit,
    }));

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