import {
  FileField,
  HiddenField,
  Select,
  SelectHouse,
  SelectNumber,
  SelectUser,
  SubscribeButton,
  TagInput,
  TextArea,
  TextField,
} from '@/components/form/form-components';
import { createFormHook, createFormHookContexts } from '@tanstack/react-form';

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

export const { useAppForm } = createFormHook({
  fieldComponents: {
    HiddenField,
    TextField,
    TextArea,
    Select,
    SelectNumber,
    FileField,
    SelectUser,
    SelectHouse,
    TagInput,
  },
  formComponents: {
    SubscribeButton,
  },
  fieldContext,
  formContext,
});
