import { SelectField } from "@repo/rdx-ui/components";
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@repo/shadcn-ui/components";
import { useFormContext } from "react-hook-form";
import { CURRENCY_OPTIONS, LANGUAGE_OPTIONS } from "../../constants";
import { useTranslation } from "../../i18n";
import { CreateCustomerFormData } from "../../schemas";

export const CustomerAdditionalConfigFields = () => {
  const { t } = useTranslation();
  const { control } = useFormContext<CreateCustomerFormData>();

  return (
    <Card className='border-0 shadow-none'>
      <CardHeader>
        <CardTitle>{t("form_groups.preferences.title")}</CardTitle>
        <CardDescription>{t("form_groups.preferences.description")}</CardDescription>
      </CardHeader>
      <CardContent>
        <div className='grid grid-cols-1 gap-6 lg:grid-cols-4 mb-12 '>
          <SelectField
            className='lg:col-span-2'
            control={control}
            name='language_code'
            required
            label={t("form_fields.language_code.label")}
            placeholder={t("form_fields.language_code.placeholder")}
            description={t("form_fields.language_code.description")}
            items={[...LANGUAGE_OPTIONS]}
          />
          <SelectField
            className='lg:col-span-2'
            control={control}
            name='currency_code'
            required
            label={t("form_fields.currency_code.label")}
            placeholder={t("form_fields.currency_code.placeholder")}
            description={t("form_fields.currency_code.description")}
            items={[...CURRENCY_OPTIONS]}
          />
        </div>
      </CardContent>
    </Card>
  );
};
