import ObjectSelect, {ObjectSelectProps} from "../../../../components/ObjectSelect/ObjectSelect.tsx";
import {RoleSchema} from "../../../../client";
import {FC} from "react";
import useRolesList from "../../hooks/useRolesList.tsx";

type Props = Omit<ObjectSelectProps<RoleSchema>, 'data' | 'getLabelFn' | 'getValueFn'>;

const RolesSelect: FC<Props> = (props) => {
    const {objects: roles} = useRolesList();
    return (
        <ObjectSelect
            getLabelFn={(position) => position.name}
            getValueFn={(position) => position.key}
            data={roles}
            {...props}
        />
    )
}
export default RolesSelect;