/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v4-mini";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
CustomsTaxIdentification,
CustomsTaxIdentification$inboundSchema,
CustomsTaxIdentification$Outbound,
CustomsTaxIdentification$outboundSchema,
} from "./customstaxidentification.js";
/**
* Additional exporter identification that may be required to ship in certain countries
*/
export type CustomsExporterIdentification = {
/**
* Economic Operators' Registration and Identification (EORI) number. Must start with a 2 character
*
* @remarks
* country code followed by a 6-17 character alphanumeric identifier (e.g. PL1234567890ABCDE).
* More information on EORI.
*/
eoriNumber?: string | undefined;
/**
* Tax identification that may be required to ship in certain countries. Typically used to assess duties on
*
* @remarks
* goods that are crossing a border.
*/
taxId?: CustomsTaxIdentification | undefined;
};
/** @internal */
export const CustomsExporterIdentification$inboundSchema: z.ZodMiniType<
CustomsExporterIdentification,
unknown
> = z.pipe(
z.object({
eori_number: z.optional(z.string()),
tax_id: z.optional(CustomsTaxIdentification$inboundSchema),
}),
z.transform((v) => {
return remap$(v, {
"eori_number": "eoriNumber",
"tax_id": "taxId",
});
}),
);
/** @internal */
export type CustomsExporterIdentification$Outbound = {
eori_number?: string | undefined;
tax_id?: CustomsTaxIdentification$Outbound | undefined;
};
/** @internal */
export const CustomsExporterIdentification$outboundSchema: z.ZodMiniType<
CustomsExporterIdentification$Outbound,
CustomsExporterIdentification
> = z.pipe(
z.object({
eoriNumber: z.optional(z.string()),
taxId: z.optional(CustomsTaxIdentification$outboundSchema),
}),
z.transform((v) => {
return remap$(v, {
eoriNumber: "eori_number",
taxId: "tax_id",
});
}),
);
export function customsExporterIdentificationToJSON(
customsExporterIdentification: CustomsExporterIdentification,
): string {
return JSON.stringify(
CustomsExporterIdentification$outboundSchema.parse(
customsExporterIdentification,
),
);
}
export function customsExporterIdentificationFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => CustomsExporterIdentification$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CustomsExporterIdentification' from JSON`,
);
}