/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { RFCDate } from "../../types/rfcdate.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type LongTermForecast = { date: RFCDate; contract: string; priceIncrease: boolean; }; /** @internal */ export const LongTermForecast$inboundSchema: z.ZodType< LongTermForecast, z.ZodTypeDef, unknown > = z.object({ date: z.string().transform(v => new RFCDate(v)), contract: z.string(), price_increase: z.boolean(), }).transform((v) => { return remap$(v, { "price_increase": "priceIncrease", }); }); /** @internal */ export type LongTermForecast$Outbound = { date: string; contract: string; price_increase: boolean; }; /** @internal */ export const LongTermForecast$outboundSchema: z.ZodType< LongTermForecast$Outbound, z.ZodTypeDef, LongTermForecast > = z.object({ date: z.instanceof(RFCDate).transform(v => v.toString()), contract: z.string(), priceIncrease: z.boolean(), }).transform((v) => { return remap$(v, { priceIncrease: "price_increase", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LongTermForecast$ { /** @deprecated use `LongTermForecast$inboundSchema` instead. */ export const inboundSchema = LongTermForecast$inboundSchema; /** @deprecated use `LongTermForecast$outboundSchema` instead. */ export const outboundSchema = LongTermForecast$outboundSchema; /** @deprecated use `LongTermForecast$Outbound` instead. */ export type Outbound = LongTermForecast$Outbound; } export function longTermForecastToJSON( longTermForecast: LongTermForecast, ): string { return JSON.stringify( LongTermForecast$outboundSchema.parse(longTermForecast), ); } export function longTermForecastFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LongTermForecast$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LongTermForecast' from JSON`, ); }