import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
import { CheckboxField } from "./CheckBox.Field";
import { ComboBoxField } from "./ComboBox.Field";
import { DynamicInputField } from "./DynamicInput.Field";
import { InputField } from "./Input.Field";
import { InputPasswordField } from "./InputPassword.Field";
import { SelectField } from "./Select.Field";
import { SubmitButton } from "./SubmitButton";
import { SwitchField } from "./Switch.Field";

export const { fieldContext, useFieldContext, formContext, useFormContext } =
	createFormHookContexts();

export const { useAppForm } = createFormHook({
	fieldComponents: {
		InputField,
		InputPasswordField,
		SelectField,
		CheckboxField,
		//DateField,
		//TextArea,
		//Searchable,
		SwitchField,
		DynamicInputField,
		ComboBoxField,
	},
	formComponents: { SubmitButton },
	fieldContext,
	formContext,
});
