/*
* 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";
/**
* Contains details regarding the service level for the carrier account.
*/
export type CarrierAccountServiceLevel = {
/**
* Service level name, e.g. `Priority Mail` or `FedEx Ground®`.
*
* @remarks
* A service level commonly defines the transit time of a Shipment (e.g., Express vs. Standard), along with other properties.
* These names vary depending on the provider.
* See Service Levels.
*/
name?: string | undefined;
/**
* Service level token, e.g. `usps_priority` or `fedex_ground`.
*
* @remarks
* See Service Levels.
*/
token?: string | undefined;
/**
* Whether or not the service level supports return labels.
*/
supportsReturnLabels?: boolean | undefined;
};
/** @internal */
export const CarrierAccountServiceLevel$inboundSchema: z.ZodMiniType<
CarrierAccountServiceLevel,
unknown
> = z.pipe(
z.object({
name: z.optional(z.string()),
token: z.optional(z.string()),
supports_return_labels: z.optional(z.boolean()),
}),
z.transform((v) => {
return remap$(v, {
"supports_return_labels": "supportsReturnLabels",
});
}),
);
export function carrierAccountServiceLevelFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => CarrierAccountServiceLevel$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CarrierAccountServiceLevel' from JSON`,
);
}