import {
  FileField,
  HiddenField,
  Select,
  SelectNumber,
  SelectUser,
  SubscribeButton,
  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,
  },
  formComponents: {
    SubscribeButton,
  },
  fieldContext,
  formContext,
});
