import { FormDebug } from "@erp/core/components";

import { cn } from '@repo/shadcn-ui/lib/utils';
import { CustomerAdditionalConfigFields } from "./customer-additional-config-fields";
import { CustomerAddressFields } from "./customer-address-fields";
import { CustomerBasicInfoFields } from "./customer-basic-info-fields";
import { CustomerContactFields } from './customer-contact-fields';

type CustomerFormProps = {
  formId: string;
  onSubmit: (event: React.FormEvent<HTMLFormElement>) => void;
  className?: string;
  focusRef?: React.RefObject<HTMLInputElement>;
};

export const CustomerEditForm = ({ formId, onSubmit, className, focusRef }: CustomerFormProps) => {
  return (
    <form noValidate id={formId} onSubmit={onSubmit}>
      <FormDebug />
      <section className={cn("space-y-6 p-6", className)}>
        <CustomerBasicInfoFields focusRef={focusRef} />
        <CustomerAddressFields />
        <CustomerContactFields />
        <CustomerAdditionalConfigFields />
      </section>
    </form>
  );
};
