import {Input} from "@/components/Input/Input";
import {useState} from "react";
import Button from "@/components/Button/Button";

export default function CarBrand({ initialData }: any) {
    const [formData, setFormData] = useState({
        id: initialData?.id || null,
        name: initialData?.name || "",
        country: initialData?.country || "",
    });

    const handleChange = (e: any) => {
        const { name, value } = e.target;
        setFormData({
            ...formData,
            [name]: value
        });
    };

    const handleSubmit = () => {
        console.log("Collected Data:", formData);
    };

    return (
        <>
            <Input value={formData.name} onChange={handleChange} name="name">Наименование</Input>
            <Input value={formData.country} onChange={handleChange} name="country">Страна</Input>
            <Button onClickAction={handleSubmit}>Сохранить</Button>
        </>
    );
}
