/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { BankAccount, BankAccount$inboundSchema, BankAccount$Outbound, BankAccount$outboundSchema, } from "./bankaccount.js"; import { Currency, Currency$inboundSchema, Currency$outboundSchema, } from "./currency.js"; import { CustomField, CustomField$inboundSchema, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { Email, Email$inboundSchema, Email$Outbound, Email$outboundSchema, } from "./email.js"; import { Gender, Gender$inboundSchema, Gender$outboundSchema, } from "./gender.js"; import { LinkedDepartment, LinkedDepartment$inboundSchema, } from "./linkeddepartment.js"; import { LinkedDepartmentInput, LinkedDepartmentInput$Outbound, LinkedDepartmentInput$outboundSchema, } from "./linkeddepartmentinput.js"; import { LinkedLocation, LinkedLocation$inboundSchema, } from "./linkedlocation.js"; import { LinkedLocationInput, LinkedLocationInput$Outbound, LinkedLocationInput$outboundSchema, } from "./linkedlocationinput.js"; import { LinkedSubsidiary, LinkedSubsidiary$inboundSchema, } from "./linkedsubsidiary.js"; import { LinkedSubsidiaryInput, LinkedSubsidiaryInput$Outbound, LinkedSubsidiaryInput$outboundSchema, } from "./linkedsubsidiaryinput.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$inboundSchema, LinkedTrackingCategory$Outbound, LinkedTrackingCategory$outboundSchema, } from "./linkedtrackingcategory.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; import { PhoneNumber, PhoneNumber$inboundSchema, PhoneNumber$Outbound, PhoneNumber$outboundSchema, } from "./phonenumber.js"; /** * The status of the employee. */ export const EmployeeStatus = { Active: "active", Inactive: "inactive", Terminated: "terminated", } as const; /** * The status of the employee. */ export type EmployeeStatus = OpenEnum; /** * The manager of the employee. */ export type AccountingEmployeeManager = { /** * A unique identifier for the manager. */ id?: string | undefined; /** * The name of the manager. */ name?: string | null | undefined; }; export type AccountingEmployee = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The third-party API ID of original entity */ downstreamId?: string | null | undefined; /** * Id to be displayed. */ displayId?: string | null | undefined; /** * The first name of the employee. */ firstName?: string | null | undefined; /** * The last name of the employee. */ lastName?: string | null | undefined; /** * The display name of the employee. */ displayName?: string | null | undefined; /** * Email addresses of the employee. */ emails?: Array | undefined; /** * The employee number or identifier. */ employeeNumber?: string | null | undefined; /** * The job title of the employee. */ jobTitle?: string | null | undefined; /** * The status of the employee. */ status?: EmployeeStatus | null | undefined; /** * Whether the employee is a contractor. */ isContractor?: boolean | null | undefined; department?: LinkedDepartment | null | undefined; location?: LinkedLocation | null | undefined; /** * The manager of the employee. */ manager?: AccountingEmployeeManager | undefined; /** * The date the employee was hired. */ hireDate?: Date | null | undefined; /** * The date the employee was terminated. */ terminationDate?: Date | null | undefined; /** * The gender represents the gender identity of a person. */ gender?: Gender | null | undefined; /** * The date of birth of the employee. */ birthDate?: Date | null | undefined; subsidiary?: LinkedSubsidiary | null | undefined; /** * A list of linked tracking categories. */ trackingCategories?: Array | 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; /** * Notes about the employee. */ notes?: string | null | undefined; /** * Addresses of the employee. */ addresses?: Array
| undefined; /** * Phone numbers of the employee. */ phoneNumbers?: Array | undefined; bankAccount?: BankAccount | undefined; customFields?: Array | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. */ rowVersion?: 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 AccountingEmployeeInput = { /** * Id to be displayed. */ displayId?: string | null | undefined; /** * The first name of the employee. */ firstName?: string | null | undefined; /** * The last name of the employee. */ lastName?: string | null | undefined; /** * The display name of the employee. */ displayName?: string | null | undefined; /** * Email addresses of the employee. */ emails?: Array | undefined; /** * The employee number or identifier. */ employeeNumber?: string | null | undefined; /** * The job title of the employee. */ jobTitle?: string | null | undefined; /** * The status of the employee. */ status?: EmployeeStatus | null | undefined; /** * Whether the employee is a contractor. */ isContractor?: boolean | null | undefined; department?: LinkedDepartmentInput | null | undefined; location?: LinkedLocationInput | null | undefined; /** * The manager of the employee. */ manager?: AccountingEmployeeManager | undefined; /** * The date the employee was hired. */ hireDate?: Date | null | undefined; /** * The date the employee was terminated. */ terminationDate?: Date | null | undefined; /** * The gender represents the gender identity of a person. */ gender?: Gender | null | undefined; /** * The date of birth of the employee. */ birthDate?: Date | null | undefined; subsidiary?: LinkedSubsidiaryInput | null | undefined; /** * A list of linked tracking categories. */ trackingCategories?: Array | 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; /** * Notes about the employee. */ notes?: string | null | undefined; /** * Addresses of the employee. */ addresses?: Array
| undefined; /** * Phone numbers of the employee. */ phoneNumbers?: Array | undefined; bankAccount?: BankAccount | undefined; customFields?: Array | undefined; /** * A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. */ rowVersion?: 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 EmployeeStatus$inboundSchema: z.ZodType< EmployeeStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(EmployeeStatus)); /** @internal */ export const EmployeeStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, EmployeeStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(EmployeeStatus)); /** @internal */ export const AccountingEmployeeManager$inboundSchema: z.ZodType< AccountingEmployeeManager, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: z.nullable(types.string()).optional(), }) ); /** @internal */ export type AccountingEmployeeManager$Outbound = { id?: string | undefined; name?: string | null | undefined; }; /** @internal */ export const AccountingEmployeeManager$outboundSchema: z.ZodType< AccountingEmployeeManager$Outbound, z.ZodTypeDef, AccountingEmployeeManager > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), name: z.nullable(z.string()).optional(), }) ); export function accountingEmployeeManagerToJSON( accountingEmployeeManager: AccountingEmployeeManager, ): string { return JSON.stringify( AccountingEmployeeManager$outboundSchema.parse(accountingEmployeeManager), ); } export function accountingEmployeeManagerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingEmployeeManager$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingEmployeeManager' from JSON`, ); } /** @internal */ export const AccountingEmployee$inboundSchema: z.ZodType< AccountingEmployee, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), downstream_id: z.nullable(types.string()).optional(), display_id: z.nullable(types.string()).optional(), first_name: z.nullable(types.string()).optional(), last_name: z.nullable(types.string()).optional(), display_name: z.nullable(types.string()).optional(), emails: types.optional(z.array(Email$inboundSchema)), employee_number: z.nullable(types.string()).optional(), job_title: z.nullable(types.string()).optional(), status: z.nullable(EmployeeStatus$inboundSchema).optional(), is_contractor: z.nullable(types.boolean()).optional(), department: z.nullable(LinkedDepartment$inboundSchema).optional(), location: z.nullable(LinkedLocation$inboundSchema).optional(), manager: types.optional( z.lazy(() => AccountingEmployeeManager$inboundSchema), ), hire_date: z.nullable(types.date()).optional(), termination_date: z.nullable(types.date()).optional(), gender: z.nullable(Gender$inboundSchema).optional(), birth_date: z.nullable(types.date()).optional(), subsidiary: z.nullable(LinkedSubsidiary$inboundSchema).optional(), tracking_categories: z.nullable( z.array(types.nullable(LinkedTrackingCategory$inboundSchema)), ).optional(), currency: z.nullable(Currency$inboundSchema).optional(), notes: z.nullable(types.string()).optional(), addresses: types.optional(z.array(Address$inboundSchema)), phone_numbers: types.optional(z.array(PhoneNumber$inboundSchema)), bank_account: types.optional(BankAccount$inboundSchema), custom_fields: types.optional(z.array(CustomField$inboundSchema)), custom_mappings: z.nullable(z.record(z.any())).optional(), row_version: z.nullable(types.string()).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "downstream_id": "downstreamId", "display_id": "displayId", "first_name": "firstName", "last_name": "lastName", "display_name": "displayName", "employee_number": "employeeNumber", "job_title": "jobTitle", "is_contractor": "isContractor", "hire_date": "hireDate", "termination_date": "terminationDate", "birth_date": "birthDate", "tracking_categories": "trackingCategories", "phone_numbers": "phoneNumbers", "bank_account": "bankAccount", "custom_fields": "customFields", "custom_mappings": "customMappings", "row_version": "rowVersion", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function accountingEmployeeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingEmployee$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingEmployee' from JSON`, ); } /** @internal */ export type AccountingEmployeeInput$Outbound = { display_id?: string | null | undefined; first_name?: string | null | undefined; last_name?: string | null | undefined; display_name?: string | null | undefined; emails?: Array | undefined; employee_number?: string | null | undefined; job_title?: string | null | undefined; status?: string | null | undefined; is_contractor?: boolean | null | undefined; department?: LinkedDepartmentInput$Outbound | null | undefined; location?: LinkedLocationInput$Outbound | null | undefined; manager?: AccountingEmployeeManager$Outbound | undefined; hire_date?: string | null | undefined; termination_date?: string | null | undefined; gender?: string | null | undefined; birth_date?: string | null | undefined; subsidiary?: LinkedSubsidiaryInput$Outbound | null | undefined; tracking_categories?: | Array | null | undefined; currency?: string | null | undefined; notes?: string | null | undefined; addresses?: Array | undefined; phone_numbers?: Array | undefined; bank_account?: BankAccount$Outbound | undefined; custom_fields?: Array | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const AccountingEmployeeInput$outboundSchema: z.ZodType< AccountingEmployeeInput$Outbound, z.ZodTypeDef, AccountingEmployeeInput > = /* @__PURE__ */ lazySchema$(() => z.object({ displayId: z.nullable(z.string()).optional(), firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), displayName: z.nullable(z.string()).optional(), emails: z.array(Email$outboundSchema).optional(), employeeNumber: z.nullable(z.string()).optional(), jobTitle: z.nullable(z.string()).optional(), status: z.nullable(EmployeeStatus$outboundSchema).optional(), isContractor: z.nullable(z.boolean()).optional(), department: z.nullable(LinkedDepartmentInput$outboundSchema).optional(), location: z.nullable(LinkedLocationInput$outboundSchema).optional(), manager: z.lazy(() => AccountingEmployeeManager$outboundSchema).optional(), hireDate: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), terminationDate: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), gender: z.nullable(Gender$outboundSchema).optional(), birthDate: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), subsidiary: z.nullable(LinkedSubsidiaryInput$outboundSchema).optional(), trackingCategories: z.nullable( z.array(z.nullable(LinkedTrackingCategory$outboundSchema)), ).optional(), currency: z.nullable(Currency$outboundSchema).optional(), notes: z.nullable(z.string()).optional(), addresses: z.array(Address$outboundSchema).optional(), phoneNumbers: z.array(PhoneNumber$outboundSchema).optional(), bankAccount: BankAccount$outboundSchema.optional(), customFields: z.array(CustomField$outboundSchema).optional(), rowVersion: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { displayId: "display_id", firstName: "first_name", lastName: "last_name", displayName: "display_name", employeeNumber: "employee_number", jobTitle: "job_title", isContractor: "is_contractor", hireDate: "hire_date", terminationDate: "termination_date", birthDate: "birth_date", trackingCategories: "tracking_categories", phoneNumbers: "phone_numbers", bankAccount: "bank_account", customFields: "custom_fields", rowVersion: "row_version", passThrough: "pass_through", }); }) ); export function accountingEmployeeInputToJSON( accountingEmployeeInput: AccountingEmployeeInput, ): string { return JSON.stringify( AccountingEmployeeInput$outboundSchema.parse(accountingEmployeeInput), ); }