/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AccountCapability, AccountCapability$inboundSchema, AccountCapability$Outbound, AccountCapability$outboundSchema, } from "./accountcapability.js"; import { AccountType, AccountType$inboundSchema, AccountType$outboundSchema, } from "./accounttype.js"; import { CustomerSupport, CustomerSupport$inboundSchema, CustomerSupport$Outbound, CustomerSupport$outboundSchema, } from "./customersupport.js"; import { Mode, Mode$inboundSchema, Mode$outboundSchema } from "./mode.js"; import { Profile, Profile$inboundSchema, Profile$Outbound, Profile$outboundSchema, } from "./profile.js"; import { Settings, Settings$inboundSchema, Settings$Outbound, Settings$outboundSchema, } from "./settings.js"; import { TermsOfService, TermsOfService$inboundSchema, TermsOfService$Outbound, TermsOfService$outboundSchema, } from "./termsofservice.js"; import { Verification, Verification$inboundSchema, Verification$Outbound, Verification$outboundSchema, } from "./verification.js"; export type Account = { /** * Unique identifier for this account. */ accountID: string; /** * The operating mode for an account. */ mode: Mode; /** * The type of entity represented by this account. */ accountType: AccountType; displayName: string; /** * Describes a Moov account profile. A profile will have a business, individual, or guest depending on the account's type. */ profile: Profile; /** * Free-form key-value pair list. Useful for storing information that is not captured elsewhere. */ metadata?: { [k: string]: string } | undefined; /** * Describes the acceptance of the Terms of Service. */ termsOfService?: TermsOfService | undefined; capabilities?: Array | undefined; /** * Describes identity verification status and relevant identity verification documents. */ verification: Verification; /** * Optional alias from a foreign/external system which can be used to reference this resource. */ foreignID?: string | undefined; /** * User-provided information that can be displayed on credit card transactions for customers to use when * * @remarks * contacting a customer support team. This data is only allowed on a business account. */ customerSupport?: CustomerSupport | undefined; /** * User provided settings to manage an account. */ settings?: Settings | undefined; createdOn: Date; updatedOn: Date; disconnectedOn?: Date | undefined; }; /** @internal */ export const Account$inboundSchema: z.ZodType = z.object({ accountID: z.string(), mode: Mode$inboundSchema, accountType: AccountType$inboundSchema, displayName: z.string(), profile: Profile$inboundSchema, metadata: z.record(z.string()).optional(), termsOfService: TermsOfService$inboundSchema.optional(), capabilities: z.array(AccountCapability$inboundSchema).optional(), verification: Verification$inboundSchema, foreignID: z.string().optional(), customerSupport: CustomerSupport$inboundSchema.optional(), settings: Settings$inboundSchema.optional(), createdOn: z.string().datetime({ offset: true }).transform(v => new Date(v) ), updatedOn: z.string().datetime({ offset: true }).transform(v => new Date(v) ), disconnectedOn: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), }); /** @internal */ export type Account$Outbound = { accountID: string; mode: string; accountType: string; displayName: string; profile: Profile$Outbound; metadata?: { [k: string]: string } | undefined; termsOfService?: TermsOfService$Outbound | undefined; capabilities?: Array | undefined; verification: Verification$Outbound; foreignID?: string | undefined; customerSupport?: CustomerSupport$Outbound | undefined; settings?: Settings$Outbound | undefined; createdOn: string; updatedOn: string; disconnectedOn?: string | undefined; }; /** @internal */ export const Account$outboundSchema: z.ZodType< Account$Outbound, z.ZodTypeDef, Account > = z.object({ accountID: z.string(), mode: Mode$outboundSchema, accountType: AccountType$outboundSchema, displayName: z.string(), profile: Profile$outboundSchema, metadata: z.record(z.string()).optional(), termsOfService: TermsOfService$outboundSchema.optional(), capabilities: z.array(AccountCapability$outboundSchema).optional(), verification: Verification$outboundSchema, foreignID: z.string().optional(), customerSupport: CustomerSupport$outboundSchema.optional(), settings: Settings$outboundSchema.optional(), createdOn: z.date().transform(v => v.toISOString()), updatedOn: z.date().transform(v => v.toISOString()), disconnectedOn: z.date().transform(v => v.toISOString()).optional(), }); export function accountToJSON(account: Account): string { return JSON.stringify(Account$outboundSchema.parse(account)); } export function accountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Account$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Account' from JSON`, ); }