import { FC } from "react";
import { ClientSchema } from "../../../client";
import useClientsList from "../../../pages/ClientsPage/hooks/useClientsList.tsx";
import ObjectSelect, { ObjectSelectProps } from "../../ObjectSelect/ObjectSelect.tsx";

type Props = Omit<
    ObjectSelectProps<ClientSchema>,
    "data" | "getLabelFn" | "getValueFn"
>;

const ClientSelect: FC<Props> = (props: Props) => {
    const { clients } = useClientsList({ all: true });


    return (
        <ObjectSelect
            {...props}
            placeholder={"Выберите клиента"}
            data={clients.filter(cl => !cl.isDeleted)}
        />
    );
};
export default ClientSelect;
