import ObjectSelect, { ObjectSelectProps } from "../../../../../components/ObjectSelect/ObjectSelect.tsx";
import { AttributeTypeSchema } from "../../../../../client";
import useAttributeTypesList from "../hooks/useAttributeTypesList.tsx";

type Props = Omit<ObjectSelectProps<AttributeTypeSchema>, "data">;

const AttributeTypeSelect = (props: Props) => {
    const { objects: attributeTypes } = useAttributeTypesList();

    return (
        <ObjectSelect
            label={"Тип атрибута"}
            getLabelFn={type => type.name}
            getValueFn={type => type.id.toString()}
            data={attributeTypes}
            {...props}
        />
    );
};

export default AttributeTypeSelect;
