/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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 CatalogHealth = { isAvailable: boolean; lastHealthCheck: number | null; error: string | null; }; /** @internal */ export const CatalogHealth$inboundSchema: z.ZodType< CatalogHealth, z.ZodTypeDef, unknown > = z.object({ is_available: z.boolean(), last_health_check: z.nullable(z.number()), error: z.nullable(z.string()), }).transform((v) => { return remap$(v, { "is_available": "isAvailable", "last_health_check": "lastHealthCheck", }); }); /** @internal */ export type CatalogHealth$Outbound = { is_available: boolean; last_health_check: number | null; error: string | null; }; /** @internal */ export const CatalogHealth$outboundSchema: z.ZodType< CatalogHealth$Outbound, z.ZodTypeDef, CatalogHealth > = z.object({ isAvailable: z.boolean(), lastHealthCheck: z.nullable(z.number()), error: z.nullable(z.string()), }).transform((v) => { return remap$(v, { isAvailable: "is_available", lastHealthCheck: "last_health_check", }); }); export function catalogHealthToJSON(catalogHealth: CatalogHealth): string { return JSON.stringify(CatalogHealth$outboundSchema.parse(catalogHealth)); } export function catalogHealthFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CatalogHealth$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CatalogHealth' from JSON`, ); }