import ObjectSelect, {
    ObjectSelectProps,
} from "../../ObjectSelect/ObjectSelect.tsx";
import { UserSchema } from "../../../client";
import { FC } from "react";
import useUsersList from "../../../pages/AdminPage/hooks/useUsersList.tsx";

type Props = Omit<
    ObjectSelectProps<UserSchema>,
    "data" | "getValueFn" | "getLabelFn"
>;
const UserSelect: FC<Props> = props => {
    const { objects: users } = useUsersList();
    return (
        <ObjectSelect
            data={users}
            getLabelFn={user => `${user.firstName} ${user.secondName}`}
            getValueFn={user => user.id.toString()}
            {...props}
        />
    );
};
export default UserSelect;
