/* * 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"; import { EnvironmentMode, EnvironmentMode$inboundSchema, EnvironmentMode$outboundSchema, } from "./environmentmode.js"; export type CustomerEntity = { /** * Unique identifier for the object. */ id: string; /** * String representing the environment. */ mode: EnvironmentMode; /** * String representing the object’s type. Objects of the same type share the same value. */ object: string; /** * Customer email address. */ email: string; /** * Customer name. */ name?: string | null | undefined; /** * The ISO alpha-2 country code for the customer. */ country: string; /** * Creation date of the product */ createdAt: Date; /** * Last updated date of the product */ updatedAt: Date; }; /** @internal */ export const CustomerEntity$inboundSchema: z.ZodType< CustomerEntity, z.ZodTypeDef, unknown > = z.object({ id: z.string(), mode: EnvironmentMode$inboundSchema, object: z.string(), email: z.string(), name: z.nullable(z.string()).optional(), country: z.string(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), }).transform((v) => { return remap$(v, { "created_at": "createdAt", "updated_at": "updatedAt", }); }); /** @internal */ export type CustomerEntity$Outbound = { id: string; mode: string; object: string; email: string; name?: string | null | undefined; country: string; created_at: string; updated_at: string; }; /** @internal */ export const CustomerEntity$outboundSchema: z.ZodType< CustomerEntity$Outbound, z.ZodTypeDef, CustomerEntity > = z.object({ id: z.string(), mode: EnvironmentMode$outboundSchema, object: z.string(), email: z.string(), name: z.nullable(z.string()).optional(), country: z.string(), createdAt: z.date().transform(v => v.toISOString()), updatedAt: z.date().transform(v => v.toISOString()), }).transform((v) => { return remap$(v, { createdAt: "created_at", updatedAt: "updated_at", }); }); export function customerEntityToJSON(customerEntity: CustomerEntity): string { return JSON.stringify(CustomerEntity$outboundSchema.parse(customerEntity)); } export function customerEntityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomerEntity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomerEntity' from JSON`, ); }