import { FC } from "react";
import { Button, Group } from "@mantine/core";
import { UseFormReturnType } from "@mantine/form";
import { ProjectSchema } from "@/lib/client";

type Props = {
    form: UseFormReturnType<ProjectSchema>;
    onDelete: () => void;
};

const Footer: FC<Props> = ({ form, onDelete }) => {
    return (
        <Group
            justify={"space-between"}
            wrap={"nowrap"}>
            <Group wrap={"nowrap"}>
                <Button
                    type={"submit"}
                    disabled={!form.isDirty()}
                    variant={"filled"}>
                    Сохранить
                </Button>
                <Button
                    type={"reset"}
                    onClick={() => form.reset()}
                    disabled={!form.isDirty()}
                    variant={"default"}>
                    Отменить
                </Button>
            </Group>
            <Button
                onClick={onDelete}
                color={"red"}
                variant={"outline"}>
                Удалить
            </Button>
        </Group>
    );
};

export default Footer;
