/* * 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"; /** * The representation of an address in Gusto. */ export type Location = { /** * The UUID of the location object. */ uuid: string; /** * The current version of the object. See the [versioning guide](https://docs.gusto.com/embedded-payroll/docs/idempotency) for information on how to use this field. */ version?: string | undefined; /** * The UUID for the company to which the location belongs. Only included if the location belongs to a company. */ companyUuid?: string | undefined; /** * The phone number for the location. Required for company locations. Optional for employee locations. */ phoneNumber?: string | undefined; street1?: string | undefined; street2?: string | null | undefined; city?: string | undefined; state?: string | undefined; zip?: string | undefined; country: string; /** * Specifies if the location is the company's mailing address. Only included if the location belongs to a company. */ mailingAddress?: boolean | undefined; /** * Specifies if the location is the company's filing address. Only included if the location belongs to a company. */ filingAddress?: boolean | undefined; /** * Datetime for when location is created */ createdAt?: string | undefined; /** * Datetime for when location is updated */ updatedAt?: string | undefined; /** * The status of the location. Inactive locations have been deleted, but may still have historical data associated with them. */ active?: boolean | undefined; /** * The status of the location. Inactive locations have been deleted, but may still have historical data associated with them. */ inactive?: boolean | undefined; }; /** @internal */ export const Location$inboundSchema: z.ZodType< Location, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), version: z.string().optional(), company_uuid: z.string().optional(), phone_number: z.string().optional(), street_1: z.string().optional(), street_2: z.nullable(z.string()).optional(), city: z.string().optional(), state: z.string().optional(), zip: z.string().optional(), country: z.string().default("USA"), mailing_address: z.boolean().optional(), filing_address: z.boolean().optional(), created_at: z.string().optional(), updated_at: z.string().optional(), active: z.boolean().optional(), inactive: z.boolean().optional(), }).transform((v) => { return remap$(v, { "company_uuid": "companyUuid", "phone_number": "phoneNumber", "street_1": "street1", "street_2": "street2", "mailing_address": "mailingAddress", "filing_address": "filingAddress", "created_at": "createdAt", "updated_at": "updatedAt", }); }); export function locationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Location$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Location' from JSON`, ); }