import Add from "@mui/icons-material/Add";
import DownloadOutlined from "@mui/icons-material/DownloadOutlined";
import ShieldOutlined from "@mui/icons-material/ShieldOutlined";
import { Button } from "@/shared/ui/Button.jsx";
import { PageHead } from "@/shared/ui/PageHead.jsx";

export function UserToolbar({ abilities, onCreate, onExport, onOpenRoles }) {
  return (
    <PageHead title="用户管理">
      {abilities.canViewRoles ? (
        <Button onClick={onOpenRoles}>
          <ShieldOutlined fontSize="small" />
          角色配置
        </Button>
      ) : null}
      {abilities.canExport ? (
        <Button onClick={onExport}>
          <DownloadOutlined fontSize="small" />
          导出
        </Button>
      ) : null}
      {abilities.canCreate ? (
        <Button variant="primary" onClick={onCreate}>
          <Add fontSize="small" />
          新增用户
        </Button>
      ) : null}
    </PageHead>
  );
}
