/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { FeatureNode, FeatureNode$inboundSchema, FeatureNode$Outbound, FeatureNode$outboundSchema, } from "./featurenode.js"; export type FeatureTreeModel = { type: { [k: string]: Array }; category: { [k: string]: Array }; region: { [k: string]: Array }; dataFrequency: { [k: string]: Array }; phenologyStage: { [k: string]: Array }; }; /** @internal */ export const FeatureTreeModel$inboundSchema: z.ZodType< FeatureTreeModel, z.ZodTypeDef, unknown > = z.object({ type: z.record(z.array(FeatureNode$inboundSchema)), category: z.record(z.array(FeatureNode$inboundSchema)), region: z.record(z.array(FeatureNode$inboundSchema)), data_frequency: z.record(z.array(FeatureNode$inboundSchema)), phenology_stage: z.record(z.array(FeatureNode$inboundSchema)), }).transform((v) => { return remap$(v, { "data_frequency": "dataFrequency", "phenology_stage": "phenologyStage", }); }); /** @internal */ export type FeatureTreeModel$Outbound = { type: { [k: string]: Array }; category: { [k: string]: Array }; region: { [k: string]: Array }; data_frequency: { [k: string]: Array }; phenology_stage: { [k: string]: Array }; }; /** @internal */ export const FeatureTreeModel$outboundSchema: z.ZodType< FeatureTreeModel$Outbound, z.ZodTypeDef, FeatureTreeModel > = z.object({ type: z.record(z.array(FeatureNode$outboundSchema)), category: z.record(z.array(FeatureNode$outboundSchema)), region: z.record(z.array(FeatureNode$outboundSchema)), dataFrequency: z.record(z.array(FeatureNode$outboundSchema)), phenologyStage: z.record(z.array(FeatureNode$outboundSchema)), }).transform((v) => { return remap$(v, { dataFrequency: "data_frequency", phenologyStage: "phenology_stage", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace FeatureTreeModel$ { /** @deprecated use `FeatureTreeModel$inboundSchema` instead. */ export const inboundSchema = FeatureTreeModel$inboundSchema; /** @deprecated use `FeatureTreeModel$outboundSchema` instead. */ export const outboundSchema = FeatureTreeModel$outboundSchema; /** @deprecated use `FeatureTreeModel$Outbound` instead. */ export type Outbound = FeatureTreeModel$Outbound; } export function featureTreeModelToJSON( featureTreeModel: FeatureTreeModel, ): string { return JSON.stringify( FeatureTreeModel$outboundSchema.parse(featureTreeModel), ); } export function featureTreeModelFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeatureTreeModel$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeatureTreeModel' from JSON`, ); }