/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ComputePlacementStrategy, ComputePlacementStrategy$inboundSchema, ComputePlacementStrategy$outboundSchema, } from "./computeplacementstrategy.js"; export type ComputePlacement = { providers?: Array | undefined; /** * How the candidate menu is ordered. providers is an unordered filter over which providers are eligible; strategy alone decides ordering. capacity_optimized, the default, groups by a curated provider precedence and sorts by price within each group. lowest_cost orders by price alone across whichever providers remain eligible. */ strategy?: ComputePlacementStrategy | undefined; }; /** @internal */ export const ComputePlacement$inboundSchema: z.ZodType< ComputePlacement, z.ZodTypeDef, unknown > = z.object({ providers: z.array(z.string()).optional(), strategy: ComputePlacementStrategy$inboundSchema.optional(), }); /** @internal */ export type ComputePlacement$Outbound = { providers?: Array | undefined; strategy?: string | undefined; }; /** @internal */ export const ComputePlacement$outboundSchema: z.ZodType< ComputePlacement$Outbound, z.ZodTypeDef, ComputePlacement > = z.object({ providers: z.array(z.string()).optional(), strategy: ComputePlacementStrategy$outboundSchema.optional(), }); export function computePlacementToJSON( computePlacement: ComputePlacement, ): string { return JSON.stringify( ComputePlacement$outboundSchema.parse(computePlacement), ); } export function computePlacementFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ComputePlacement$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ComputePlacement' from JSON`, ); }