import { useTranslation } from "react-i18next"; import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; import { type AccessConfigForGoogleTrustServices } from "@/domain/access"; type AccessFormGoogleTrustServicesConfigFieldValues = Nullish; export type AccessFormGoogleTrustServicesConfigProps = { form: FormInstance; formName: string; disabled?: boolean; initialValues?: AccessFormGoogleTrustServicesConfigFieldValues; onValuesChange?: (values: AccessFormGoogleTrustServicesConfigFieldValues) => void; }; const initFormModel = (): AccessFormGoogleTrustServicesConfigFieldValues => { return { eabKid: "", eabHmacKey: "", }; }; const AccessFormGoogleTrustServicesConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange, }: AccessFormGoogleTrustServicesConfigProps) => { const { t } = useTranslation(); const formSchema = z.object({ eabKid: z .string() .min(1, t("access.form.googletrustservices_eab_kid.placeholder")) .max(256, t("common.errmsg.string_max", { max: 256 })) .trim(), eabHmacKey: z .string() .min(1, t("access.form.googletrustservices_eab_hmac_key.placeholder")) .max(256, t("common.errmsg.string_max", { max: 256 })) .trim(), }); const formRule = createSchemaFieldRule(formSchema); const handleFormChange = (_: unknown, values: z.infer) => { onValuesChange?.(values); }; return (
} > } >
); }; export default AccessFormGoogleTrustServicesConfig;