/*
* 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 { ClosedEnum } from "../../types/enums.js";
import {
AddressImporter,
AddressImporter$Outbound,
AddressImporter$outboundSchema,
} from "./addressimporter.js";
import {
CustomsDeclarationB13AFilingOptionEnum,
CustomsDeclarationB13AFilingOptionEnum$outboundSchema,
} from "./customsdeclarationb13afilingoptionenum.js";
import {
CustomsDeclarationContentsTypeEnum,
CustomsDeclarationContentsTypeEnum$outboundSchema,
} from "./customsdeclarationcontentstypeenum.js";
import {
CustomsDeclarationEelPfcEnum,
CustomsDeclarationEelPfcEnum$outboundSchema,
} from "./customsdeclarationeelpfcenum.js";
import {
CustomsDeclarationIncotermEnum,
CustomsDeclarationIncotermEnum$outboundSchema,
} from "./customsdeclarationincotermenum.js";
import {
CustomsDeclarationNonDeliveryOptionEnum,
CustomsDeclarationNonDeliveryOptionEnum$outboundSchema,
} from "./customsdeclarationnondeliveryoptionenum.js";
import {
CustomsExporterIdentification,
CustomsExporterIdentification$Outbound,
CustomsExporterIdentification$outboundSchema,
} from "./customsexporteridentification.js";
import {
CustomsItemCreateRequest,
CustomsItemCreateRequest$Outbound,
CustomsItemCreateRequest$outboundSchema,
} from "./customsitemcreaterequest.js";
/**
* Party to be billed for duties.
*/
export const CustomsDeclarationCreateRequestType = {
Sender: "SENDER",
Recipient: "RECIPIENT",
ThirdParty: "THIRD_PARTY",
} as const;
/**
* Party to be billed for duties.
*/
export type CustomsDeclarationCreateRequestType = ClosedEnum<
typeof CustomsDeclarationCreateRequestType
>;
export type CustomsDeclarationCreateRequestAddress = {
/**
* Name of the party to be billed for duties.
*/
name?: string | undefined;
/**
* Postal code of the party to be billed for duties.
*/
zip?: string | undefined;
/**
* Country ISO code of account number to be billed.
*/
country?: string | undefined;
};
/**
* Specifies who will pay the duties for the shipment. Only accepted for FedEx shipments.
*/
export type DutiesPayor = {
/**
* Account number to be billed for duties.
*/
account?: string | undefined;
/**
* Party to be billed for duties.
*/
type?: CustomsDeclarationCreateRequestType | undefined;
address?: CustomsDeclarationCreateRequestAddress | undefined;
};
export type CustomsDeclarationCreateRequest = {
/**
* **required if eel_pfc is `AES_ITN`**
*
* @remarks
* AES / ITN reference of the shipment.
*/
aesItn?: string | undefined;
b13aFilingOption?: CustomsDeclarationB13AFilingOptionEnum | undefined;
/**
* **must be provided if and only if b13a_filing_option is provided**
*
* @remarks
* Represents:
the Proof of Report (POR) Number when b13a_filing_option is `FILED_ELECTRONICALLY`;
* the Summary ID Number when b13a_filing_option is `SUMMARY_REPORTING`;
* or the Exemption Number when b13a_filing_option is `NOT_REQUIRED`.
*/
b13aNumber?: string | undefined;
/**
* Certificate reference of the shipment.
*/
certificate?: string | undefined;
/**
* Expresses that the certify_signer has provided all information of this customs declaration truthfully.
*/
certify: boolean;
/**
* Name of the person who created the customs declaration and is responsible for the validity of all
*
* @remarks
* information provided.
*/
certifySigner: string;
commercialInvoice?: boolean | undefined;
/**
* **required if contents_type is `OTHER`**
*
* @remarks
* Explanation of the type of goods of the shipment.
*/
contentsExplanation?: string | undefined;
/**
* Disclaimer for the shipment and customs information that have been provided.
*/
disclaimer?: string | undefined;
/**
* Specifies who will pay the duties for the shipment. Only accepted for FedEx shipments.
*/
dutiesPayor?: DutiesPayor | undefined;
/**
* Additional exporter identification that may be required to ship in certain countries
*/
exporterIdentification?: CustomsExporterIdentification | undefined;
/**
* Exporter reference of an export shipment.
*/
exporterReference?: string | undefined;
/**
* Importer reference of an import shipment.
*/
importerReference?: string | undefined;
/**
* Indicates whether the shipment's destination VAT has been collected. May be required for some destinations.
*/
isVatCollected?: boolean | undefined;
/**
* Invoice reference of the shipment.
*/
invoice?: string | undefined;
/**
* License reference of the shipment.
*/
license?: string | undefined;
/**
* A string of up to 100 characters that can be filled with any additional information you
*
* @remarks
* want to attach to the object.
*/
metadata?: string | undefined;
/**
* Additional notes to be included in the customs declaration.
*/
notes?: string | undefined;
/**
* Object that represents the address of the importer
*/
addressImporter?: AddressImporter | undefined;
contentsType: CustomsDeclarationContentsTypeEnum;
eelPfc?: CustomsDeclarationEelPfcEnum | undefined;
incoterm?: CustomsDeclarationIncotermEnum | undefined;
items: Array;
nonDeliveryOption: CustomsDeclarationNonDeliveryOptionEnum;
test?: boolean | undefined;
};
/** @internal */
export const CustomsDeclarationCreateRequestType$outboundSchema: z.ZodMiniEnum<
typeof CustomsDeclarationCreateRequestType
> = z.enum(CustomsDeclarationCreateRequestType);
/** @internal */
export type CustomsDeclarationCreateRequestAddress$Outbound = {
name?: string | undefined;
zip?: string | undefined;
country?: string | undefined;
};
/** @internal */
export const CustomsDeclarationCreateRequestAddress$outboundSchema:
z.ZodMiniType<
CustomsDeclarationCreateRequestAddress$Outbound,
CustomsDeclarationCreateRequestAddress
> = z.object({
name: z.optional(z.string()),
zip: z.optional(z.string()),
country: z.optional(z.string()),
});
export function customsDeclarationCreateRequestAddressToJSON(
customsDeclarationCreateRequestAddress:
CustomsDeclarationCreateRequestAddress,
): string {
return JSON.stringify(
CustomsDeclarationCreateRequestAddress$outboundSchema.parse(
customsDeclarationCreateRequestAddress,
),
);
}
/** @internal */
export type DutiesPayor$Outbound = {
account?: string | undefined;
type?: string | undefined;
address?: CustomsDeclarationCreateRequestAddress$Outbound | undefined;
};
/** @internal */
export const DutiesPayor$outboundSchema: z.ZodMiniType<
DutiesPayor$Outbound,
DutiesPayor
> = z.object({
account: z.optional(z.string()),
type: z.optional(CustomsDeclarationCreateRequestType$outboundSchema),
address: z.optional(
z.lazy(() => CustomsDeclarationCreateRequestAddress$outboundSchema),
),
});
export function dutiesPayorToJSON(dutiesPayor: DutiesPayor): string {
return JSON.stringify(DutiesPayor$outboundSchema.parse(dutiesPayor));
}
/** @internal */
export type CustomsDeclarationCreateRequest$Outbound = {
aes_itn?: string | undefined;
b13a_filing_option?: string | undefined;
b13a_number?: string | undefined;
certificate?: string | undefined;
certify: boolean;
certify_signer: string;
commercial_invoice?: boolean | undefined;
contents_explanation?: string | undefined;
disclaimer?: string | undefined;
duties_payor?: DutiesPayor$Outbound | undefined;
exporter_identification?: CustomsExporterIdentification$Outbound | undefined;
exporter_reference?: string | undefined;
importer_reference?: string | undefined;
is_vat_collected?: boolean | undefined;
invoice?: string | undefined;
license?: string | undefined;
metadata?: string | undefined;
notes?: string | undefined;
address_importer?: AddressImporter$Outbound | undefined;
contents_type: string;
eel_pfc?: string | undefined;
incoterm?: string | undefined;
items: Array;
non_delivery_option: string;
test?: boolean | undefined;
};
/** @internal */
export const CustomsDeclarationCreateRequest$outboundSchema: z.ZodMiniType<
CustomsDeclarationCreateRequest$Outbound,
CustomsDeclarationCreateRequest
> = z.pipe(
z.object({
aesItn: z.optional(z.string()),
b13aFilingOption: z.optional(
CustomsDeclarationB13AFilingOptionEnum$outboundSchema,
),
b13aNumber: z.optional(z.string()),
certificate: z.optional(z.string()),
certify: z.boolean(),
certifySigner: z.string(),
commercialInvoice: z.optional(z.boolean()),
contentsExplanation: z.optional(z.string()),
disclaimer: z.optional(z.string()),
dutiesPayor: z.optional(z.lazy(() => DutiesPayor$outboundSchema)),
exporterIdentification: z.optional(
CustomsExporterIdentification$outboundSchema,
),
exporterReference: z.optional(z.string()),
importerReference: z.optional(z.string()),
isVatCollected: z.optional(z.boolean()),
invoice: z.optional(z.string()),
license: z.optional(z.string()),
metadata: z.optional(z.string()),
notes: z.optional(z.string()),
addressImporter: z.optional(AddressImporter$outboundSchema),
contentsType: CustomsDeclarationContentsTypeEnum$outboundSchema,
eelPfc: z.optional(CustomsDeclarationEelPfcEnum$outboundSchema),
incoterm: z.optional(CustomsDeclarationIncotermEnum$outboundSchema),
items: z.array(CustomsItemCreateRequest$outboundSchema),
nonDeliveryOption: CustomsDeclarationNonDeliveryOptionEnum$outboundSchema,
test: z.optional(z.boolean()),
}),
z.transform((v) => {
return remap$(v, {
aesItn: "aes_itn",
b13aFilingOption: "b13a_filing_option",
b13aNumber: "b13a_number",
certifySigner: "certify_signer",
commercialInvoice: "commercial_invoice",
contentsExplanation: "contents_explanation",
dutiesPayor: "duties_payor",
exporterIdentification: "exporter_identification",
exporterReference: "exporter_reference",
importerReference: "importer_reference",
isVatCollected: "is_vat_collected",
addressImporter: "address_importer",
contentsType: "contents_type",
eelPfc: "eel_pfc",
nonDeliveryOption: "non_delivery_option",
});
}),
);
export function customsDeclarationCreateRequestToJSON(
customsDeclarationCreateRequest: CustomsDeclarationCreateRequest,
): string {
return JSON.stringify(
CustomsDeclarationCreateRequest$outboundSchema.parse(
customsDeclarationCreateRequest,
),
);
}