/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { Currency, Currency$inboundSchema, Currency$outboundSchema, } from "./currency.js"; import { CustomMappings, CustomMappings$inboundSchema, CustomMappings$Outbound, CustomMappings$outboundSchema, } from "./custommappings.js"; import { Email, Email$inboundSchema, Email$Outbound, Email$outboundSchema, } from "./email.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; import { PhoneNumber, PhoneNumber$inboundSchema, PhoneNumber$Outbound, PhoneNumber$outboundSchema, } from "./phonenumber.js"; import { Website, Website$inboundSchema, Website$Outbound, Website$outboundSchema, } from "./website.js"; export const HrisCompanyStatus = { Active: "active", Inactive: "inactive", Trial: "trial", Other: "other", } as const; export type HrisCompanyStatus = ClosedEnum; export type HrisCompany = { /** * A unique identifier for an object. */ id?: string | undefined; legalName: string | null; displayName?: string | null | undefined; subdomain?: string | null | undefined; status?: HrisCompanyStatus | undefined; /** * An Company Number, Company ID or Company Code, is a unique number that has been assigned to each company. */ companyNumber?: string | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; addresses?: Array
| undefined; phoneNumbers?: Array | undefined; emails?: Array | undefined; websites?: Array | undefined; debtorId?: string | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: CustomMappings | null | undefined; deleted?: boolean | undefined; /** * The user who last updated the object. */ updatedBy?: string | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; export type HrisCompanyInput = { legalName: string | null; displayName?: string | null | undefined; subdomain?: string | null | undefined; status?: HrisCompanyStatus | undefined; /** * An Company Number, Company ID or Company Code, is a unique number that has been assigned to each company. */ companyNumber?: string | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; addresses?: Array
| undefined; phoneNumbers?: Array | undefined; emails?: Array | undefined; websites?: Array | undefined; debtorId?: string | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export const HrisCompanyStatus$inboundSchema: z.ZodNativeEnum< typeof HrisCompanyStatus > = z.nativeEnum(HrisCompanyStatus); /** @internal */ export const HrisCompanyStatus$outboundSchema: z.ZodNativeEnum< typeof HrisCompanyStatus > = HrisCompanyStatus$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace HrisCompanyStatus$ { /** @deprecated use `HrisCompanyStatus$inboundSchema` instead. */ export const inboundSchema = HrisCompanyStatus$inboundSchema; /** @deprecated use `HrisCompanyStatus$outboundSchema` instead. */ export const outboundSchema = HrisCompanyStatus$outboundSchema; } /** @internal */ export const HrisCompany$inboundSchema: z.ZodType< HrisCompany, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), legal_name: z.nullable(z.string()), display_name: z.nullable(z.string()).optional(), subdomain: z.nullable(z.string()).optional(), status: HrisCompanyStatus$inboundSchema.optional(), company_number: z.nullable(z.string()).optional(), currency: z.nullable(Currency$inboundSchema).optional(), addresses: z.array(Address$inboundSchema).optional(), phone_numbers: z.array(PhoneNumber$inboundSchema).optional(), emails: z.array(Email$inboundSchema).optional(), websites: z.array(Website$inboundSchema).optional(), debtor_id: z.nullable(z.string()).optional(), custom_mappings: z.nullable(CustomMappings$inboundSchema).optional(), deleted: z.boolean().optional(), updated_by: z.nullable(z.string()).optional(), created_by: z.nullable(z.string()).optional(), updated_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), created_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), pass_through: z.array(PassThroughBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "legal_name": "legalName", "display_name": "displayName", "company_number": "companyNumber", "phone_numbers": "phoneNumbers", "debtor_id": "debtorId", "custom_mappings": "customMappings", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }); /** @internal */ export type HrisCompany$Outbound = { id?: string | undefined; legal_name: string | null; display_name?: string | null | undefined; subdomain?: string | null | undefined; status?: string | undefined; company_number?: string | null | undefined; currency?: string | null | undefined; addresses?: Array | undefined; phone_numbers?: Array | undefined; emails?: Array | undefined; websites?: Array | undefined; debtor_id?: string | null | undefined; custom_mappings?: CustomMappings$Outbound | null | undefined; deleted?: boolean | undefined; updated_by?: string | null | undefined; created_by?: string | null | undefined; updated_at?: string | null | undefined; created_at?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const HrisCompany$outboundSchema: z.ZodType< HrisCompany$Outbound, z.ZodTypeDef, HrisCompany > = z.object({ id: z.string().optional(), legalName: z.nullable(z.string()), displayName: z.nullable(z.string()).optional(), subdomain: z.nullable(z.string()).optional(), status: HrisCompanyStatus$outboundSchema.optional(), companyNumber: z.nullable(z.string()).optional(), currency: z.nullable(Currency$outboundSchema).optional(), addresses: z.array(Address$outboundSchema).optional(), phoneNumbers: z.array(PhoneNumber$outboundSchema).optional(), emails: z.array(Email$outboundSchema).optional(), websites: z.array(Website$outboundSchema).optional(), debtorId: z.nullable(z.string()).optional(), customMappings: z.nullable(CustomMappings$outboundSchema).optional(), deleted: z.boolean().optional(), updatedBy: z.nullable(z.string()).optional(), createdBy: z.nullable(z.string()).optional(), updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { legalName: "legal_name", displayName: "display_name", companyNumber: "company_number", phoneNumbers: "phone_numbers", debtorId: "debtor_id", customMappings: "custom_mappings", updatedBy: "updated_by", createdBy: "created_by", updatedAt: "updated_at", createdAt: "created_at", passThrough: "pass_through", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace HrisCompany$ { /** @deprecated use `HrisCompany$inboundSchema` instead. */ export const inboundSchema = HrisCompany$inboundSchema; /** @deprecated use `HrisCompany$outboundSchema` instead. */ export const outboundSchema = HrisCompany$outboundSchema; /** @deprecated use `HrisCompany$Outbound` instead. */ export type Outbound = HrisCompany$Outbound; } export function hrisCompanyToJSON(hrisCompany: HrisCompany): string { return JSON.stringify(HrisCompany$outboundSchema.parse(hrisCompany)); } export function hrisCompanyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => HrisCompany$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'HrisCompany' from JSON`, ); } /** @internal */ export const HrisCompanyInput$inboundSchema: z.ZodType< HrisCompanyInput, z.ZodTypeDef, unknown > = z.object({ legal_name: z.nullable(z.string()), display_name: z.nullable(z.string()).optional(), subdomain: z.nullable(z.string()).optional(), status: HrisCompanyStatus$inboundSchema.optional(), company_number: z.nullable(z.string()).optional(), currency: z.nullable(Currency$inboundSchema).optional(), addresses: z.array(Address$inboundSchema).optional(), phone_numbers: z.array(PhoneNumber$inboundSchema).optional(), emails: z.array(Email$inboundSchema).optional(), websites: z.array(Website$inboundSchema).optional(), debtor_id: z.nullable(z.string()).optional(), pass_through: z.array(PassThroughBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "legal_name": "legalName", "display_name": "displayName", "company_number": "companyNumber", "phone_numbers": "phoneNumbers", "debtor_id": "debtorId", "pass_through": "passThrough", }); }); /** @internal */ export type HrisCompanyInput$Outbound = { legal_name: string | null; display_name?: string | null | undefined; subdomain?: string | null | undefined; status?: string | undefined; company_number?: string | null | undefined; currency?: string | null | undefined; addresses?: Array | undefined; phone_numbers?: Array | undefined; emails?: Array | undefined; websites?: Array | undefined; debtor_id?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const HrisCompanyInput$outboundSchema: z.ZodType< HrisCompanyInput$Outbound, z.ZodTypeDef, HrisCompanyInput > = z.object({ legalName: z.nullable(z.string()), displayName: z.nullable(z.string()).optional(), subdomain: z.nullable(z.string()).optional(), status: HrisCompanyStatus$outboundSchema.optional(), companyNumber: z.nullable(z.string()).optional(), currency: z.nullable(Currency$outboundSchema).optional(), addresses: z.array(Address$outboundSchema).optional(), phoneNumbers: z.array(PhoneNumber$outboundSchema).optional(), emails: z.array(Email$outboundSchema).optional(), websites: z.array(Website$outboundSchema).optional(), debtorId: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { legalName: "legal_name", displayName: "display_name", companyNumber: "company_number", phoneNumbers: "phone_numbers", debtorId: "debtor_id", passThrough: "pass_through", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace HrisCompanyInput$ { /** @deprecated use `HrisCompanyInput$inboundSchema` instead. */ export const inboundSchema = HrisCompanyInput$inboundSchema; /** @deprecated use `HrisCompanyInput$outboundSchema` instead. */ export const outboundSchema = HrisCompanyInput$outboundSchema; /** @deprecated use `HrisCompanyInput$Outbound` instead. */ export type Outbound = HrisCompanyInput$Outbound; } export function hrisCompanyInputToJSON( hrisCompanyInput: HrisCompanyInput, ): string { return JSON.stringify( HrisCompanyInput$outboundSchema.parse(hrisCompanyInput), ); } export function hrisCompanyInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => HrisCompanyInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'HrisCompanyInput' from JSON`, ); }