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

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

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