import { TagsInput, TagsInputProps } from "@mantine/core";
import useTransactionTagsList from "../../../hooks/useTransactionTagsList.tsx";


type IsIncome = {
    isIncome: boolean;
}
type Props = Omit<TagsInputProps, "data"> & IsIncome;

const TransactionTagsInput = (props: Props) => {
    const { objects } = useTransactionTagsList({ isIncome: props.isIncome });
    return (
        <TagsInput
            data={objects.map(object => object.name)}
            {...props}
            label={"Теги"}
            placeholder={"Выберите теги"}
        />
    );
};

export default TransactionTagsInput;