/* * 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"; import { ForecastTrajectory, ForecastTrajectory$inboundSchema, ForecastTrajectory$Outbound, ForecastTrajectory$outboundSchema, } from "./forecasttrajectory.js"; export type AssetForecastModelData = { modelType: string; modelName: string; displayName: string; startDate: RFCDate; endDate: RFCDate; horizons: Array; indicators: Array; native: boolean; targetType?: string | null | undefined; rollingMeanWindows?: Array | null | undefined; features?: Array | null | undefined; strategy?: Array | null | undefined; }; /** @internal */ export const AssetForecastModelData$inboundSchema: z.ZodType< AssetForecastModelData, z.ZodTypeDef, unknown > = z.object({ model_type: z.string(), model_name: z.string(), display_name: z.string(), start_date: z.string().transform(v => new RFCDate(v)), end_date: z.string().transform(v => new RFCDate(v)), horizons: z.array(z.number().int()), indicators: z.array(z.string()), native: z.boolean(), target_type: z.nullable(z.string()).optional(), rolling_mean_windows: z.nullable(z.array(z.number().int())).optional(), features: z.nullable(z.array(z.string())).optional(), strategy: z.nullable(z.array(ForecastTrajectory$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "model_type": "modelType", "model_name": "modelName", "display_name": "displayName", "start_date": "startDate", "end_date": "endDate", "target_type": "targetType", "rolling_mean_windows": "rollingMeanWindows", }); }); /** @internal */ export type AssetForecastModelData$Outbound = { model_type: string; model_name: string; display_name: string; start_date: string; end_date: string; horizons: Array; indicators: Array; native: boolean; target_type?: string | null | undefined; rolling_mean_windows?: Array | null | undefined; features?: Array | null | undefined; strategy?: Array | null | undefined; }; /** @internal */ export const AssetForecastModelData$outboundSchema: z.ZodType< AssetForecastModelData$Outbound, z.ZodTypeDef, AssetForecastModelData > = z.object({ modelType: z.string(), modelName: z.string(), displayName: z.string(), startDate: z.instanceof(RFCDate).transform(v => v.toString()), endDate: z.instanceof(RFCDate).transform(v => v.toString()), horizons: z.array(z.number().int()), indicators: z.array(z.string()), native: z.boolean(), targetType: z.nullable(z.string()).optional(), rollingMeanWindows: z.nullable(z.array(z.number().int())).optional(), features: z.nullable(z.array(z.string())).optional(), strategy: z.nullable(z.array(ForecastTrajectory$outboundSchema)).optional(), }).transform((v) => { return remap$(v, { modelType: "model_type", modelName: "model_name", displayName: "display_name", startDate: "start_date", endDate: "end_date", targetType: "target_type", rollingMeanWindows: "rolling_mean_windows", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AssetForecastModelData$ { /** @deprecated use `AssetForecastModelData$inboundSchema` instead. */ export const inboundSchema = AssetForecastModelData$inboundSchema; /** @deprecated use `AssetForecastModelData$outboundSchema` instead. */ export const outboundSchema = AssetForecastModelData$outboundSchema; /** @deprecated use `AssetForecastModelData$Outbound` instead. */ export type Outbound = AssetForecastModelData$Outbound; } export function assetForecastModelDataToJSON( assetForecastModelData: AssetForecastModelData, ): string { return JSON.stringify( AssetForecastModelData$outboundSchema.parse(assetForecastModelData), ); } export function assetForecastModelDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AssetForecastModelData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AssetForecastModelData' from JSON`, ); }