"use client";

import { FC } from "react";
import { ProjectSchema } from "@/lib/client";
import ObjectSelect, {
    ObjectSelectProps,
} from "@/components/selects/ObjectSelect/ObjectSelect";

type Props = Omit<
    ObjectSelectProps<ProjectSchema | null>,
    "getLabelFn" | "getValueFn"
>;

const ProjectSelect: FC<Props> = ({ data, ...props }) => {
    const onClear = () => props.onChange(null);

    return (
        <ObjectSelect
            data={data}
            searchable
            placeholder={"Выберите проект"}
            onClear={onClear}
            {...props}
        />
    );
};

export default ProjectSelect;
