/*
* 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";
export type ServiceGroupAccountAndServiceLevel = {
/**
* ID of a Carrier Account object
*/
accountObjectId?: string | undefined;
/**
* Service level token, e.g. `usps_priority` or `fedex_ground`.
*
* @remarks
* See Service Levels.
*/
serviceLevelToken?: string | undefined;
};
/** @internal */
export const ServiceGroupAccountAndServiceLevel$inboundSchema: z.ZodMiniType<
ServiceGroupAccountAndServiceLevel,
unknown
> = z.pipe(
z.object({
account_object_id: z.optional(z.string()),
service_level_token: z.optional(z.string()),
}),
z.transform((v) => {
return remap$(v, {
"account_object_id": "accountObjectId",
"service_level_token": "serviceLevelToken",
});
}),
);
/** @internal */
export type ServiceGroupAccountAndServiceLevel$Outbound = {
account_object_id?: string | undefined;
service_level_token?: string | undefined;
};
/** @internal */
export const ServiceGroupAccountAndServiceLevel$outboundSchema: z.ZodMiniType<
ServiceGroupAccountAndServiceLevel$Outbound,
ServiceGroupAccountAndServiceLevel
> = z.pipe(
z.object({
accountObjectId: z.optional(z.string()),
serviceLevelToken: z.optional(z.string()),
}),
z.transform((v) => {
return remap$(v, {
accountObjectId: "account_object_id",
serviceLevelToken: "service_level_token",
});
}),
);
export function serviceGroupAccountAndServiceLevelToJSON(
serviceGroupAccountAndServiceLevel: ServiceGroupAccountAndServiceLevel,
): string {
return JSON.stringify(
ServiceGroupAccountAndServiceLevel$outboundSchema.parse(
serviceGroupAccountAndServiceLevel,
),
);
}
export function serviceGroupAccountAndServiceLevelFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) =>
ServiceGroupAccountAndServiceLevel$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ServiceGroupAccountAndServiceLevel' from JSON`,
);
}