import { AppContext } from "@/src/pages/_app";
import { TurboCISignupFormObject } from "@/src/types";
import useStatus from "@/twui/components/hooks/useStatus";
import { useContext, useState } from "react";

export default function useSettingsForm() {
    const { pageProps } = useContext(AppContext);
    const { user } = pageProps;
    const { loading, setLoading } = useStatus();

    const [formData, setFormData] = useState<TurboCISignupFormObject>({
        first_name: user?.first_name || "",
        last_name: user?.last_name || "",
        email: user?.email || "",
        image: user?.image || "",
    });

    return {
        formData,
        setFormData,
        loading,
        setLoading,
        user,
    };
}
