/* * 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 { RFCDate } from "../../types/rfcdate.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 { PaymentUnit, PaymentUnit$inboundSchema, PaymentUnit$outboundSchema, } from "./paymentunit.js"; /** * Indicates the status of the job. */ export const EmployeeJobStatus = { Active: "active", Inactive: "inactive", Other: "other", } as const; /** * Indicates the status of the job. */ export type EmployeeJobStatus = ClosedEnum; export type EmployeeJob = { /** * A unique identifier for an object. */ id?: string | null | undefined; /** * A unique identifier for an object. */ employeeId?: string | null | undefined; /** * The job title of the person. */ title?: string | null | undefined; /** * The position and responsibilities of the person within the organization. */ role?: string | null | undefined; /** * The date on which the employee starts working in their current job role. */ startDate?: RFCDate | null | undefined; /** * The date on which the employee leaves or is expected to leave their current job role. */ endDate?: RFCDate | null | undefined; /** * The rate of pay for the employee in their current job role. */ compensationRate?: number | 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; /** * Unit of measurement for employee compensation. */ paymentUnit?: PaymentUnit | null | undefined; /** * The date on which the employee was hired by the organization */ hiredAt?: RFCDate | null | undefined; /** * Indicates whether this the employee's primary job. */ isPrimary?: boolean | null | undefined; /** * Indicates whether this the employee has a manager role. */ isManager?: boolean | null | undefined; /** * Indicates the status of the job. */ status?: EmployeeJobStatus | null | undefined; location?: Address | undefined; }; export type EmployeeJobInput = { /** * The job title of the person. */ title?: string | null | undefined; /** * The position and responsibilities of the person within the organization. */ role?: string | null | undefined; /** * The date on which the employee starts working in their current job role. */ startDate?: RFCDate | null | undefined; /** * The date on which the employee leaves or is expected to leave their current job role. */ endDate?: RFCDate | null | undefined; /** * The rate of pay for the employee in their current job role. */ compensationRate?: number | 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; /** * Unit of measurement for employee compensation. */ paymentUnit?: PaymentUnit | null | undefined; /** * The date on which the employee was hired by the organization */ hiredAt?: RFCDate | null | undefined; /** * Indicates whether this the employee's primary job. */ isPrimary?: boolean | null | undefined; /** * Indicates whether this the employee has a manager role. */ isManager?: boolean | null | undefined; /** * Indicates the status of the job. */ status?: EmployeeJobStatus | null | undefined; location?: Address | undefined; }; /** @internal */ export const EmployeeJobStatus$inboundSchema: z.ZodNativeEnum< typeof EmployeeJobStatus > = z.nativeEnum(EmployeeJobStatus); /** @internal */ export const EmployeeJobStatus$outboundSchema: z.ZodNativeEnum< typeof EmployeeJobStatus > = EmployeeJobStatus$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace EmployeeJobStatus$ { /** @deprecated use `EmployeeJobStatus$inboundSchema` instead. */ export const inboundSchema = EmployeeJobStatus$inboundSchema; /** @deprecated use `EmployeeJobStatus$outboundSchema` instead. */ export const outboundSchema = EmployeeJobStatus$outboundSchema; } /** @internal */ export const EmployeeJob$inboundSchema: z.ZodType< EmployeeJob, z.ZodTypeDef, unknown > = z.object({ id: z.nullable(z.string()).optional(), employee_id: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), role: z.nullable(z.string()).optional(), start_date: z.nullable(z.string().transform(v => new RFCDate(v))).optional(), end_date: z.nullable(z.string().transform(v => new RFCDate(v))).optional(), compensation_rate: z.nullable(z.number()).optional(), currency: z.nullable(Currency$inboundSchema).optional(), payment_unit: z.nullable(PaymentUnit$inboundSchema).optional(), hired_at: z.nullable(z.string().transform(v => new RFCDate(v))).optional(), is_primary: z.nullable(z.boolean()).optional(), is_manager: z.nullable(z.boolean()).optional(), status: z.nullable(EmployeeJobStatus$inboundSchema).optional(), location: Address$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "employee_id": "employeeId", "start_date": "startDate", "end_date": "endDate", "compensation_rate": "compensationRate", "payment_unit": "paymentUnit", "hired_at": "hiredAt", "is_primary": "isPrimary", "is_manager": "isManager", }); }); /** @internal */ export type EmployeeJob$Outbound = { id?: string | null | undefined; employee_id?: string | null | undefined; title?: string | null | undefined; role?: string | null | undefined; start_date?: string | null | undefined; end_date?: string | null | undefined; compensation_rate?: number | null | undefined; currency?: string | null | undefined; payment_unit?: string | null | undefined; hired_at?: string | null | undefined; is_primary?: boolean | null | undefined; is_manager?: boolean | null | undefined; status?: string | null | undefined; location?: Address$Outbound | undefined; }; /** @internal */ export const EmployeeJob$outboundSchema: z.ZodType< EmployeeJob$Outbound, z.ZodTypeDef, EmployeeJob > = z.object({ id: z.nullable(z.string()).optional(), employeeId: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), role: z.nullable(z.string()).optional(), startDate: z.nullable(z.instanceof(RFCDate).transform(v => v.toString())) .optional(), endDate: z.nullable(z.instanceof(RFCDate).transform(v => v.toString())) .optional(), compensationRate: z.nullable(z.number()).optional(), currency: z.nullable(Currency$outboundSchema).optional(), paymentUnit: z.nullable(PaymentUnit$outboundSchema).optional(), hiredAt: z.nullable(z.instanceof(RFCDate).transform(v => v.toString())) .optional(), isPrimary: z.nullable(z.boolean()).optional(), isManager: z.nullable(z.boolean()).optional(), status: z.nullable(EmployeeJobStatus$outboundSchema).optional(), location: Address$outboundSchema.optional(), }).transform((v) => { return remap$(v, { employeeId: "employee_id", startDate: "start_date", endDate: "end_date", compensationRate: "compensation_rate", paymentUnit: "payment_unit", hiredAt: "hired_at", isPrimary: "is_primary", isManager: "is_manager", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace EmployeeJob$ { /** @deprecated use `EmployeeJob$inboundSchema` instead. */ export const inboundSchema = EmployeeJob$inboundSchema; /** @deprecated use `EmployeeJob$outboundSchema` instead. */ export const outboundSchema = EmployeeJob$outboundSchema; /** @deprecated use `EmployeeJob$Outbound` instead. */ export type Outbound = EmployeeJob$Outbound; } export function employeeJobToJSON(employeeJob: EmployeeJob): string { return JSON.stringify(EmployeeJob$outboundSchema.parse(employeeJob)); } export function employeeJobFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmployeeJob$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmployeeJob' from JSON`, ); } /** @internal */ export const EmployeeJobInput$inboundSchema: z.ZodType< EmployeeJobInput, z.ZodTypeDef, unknown > = z.object({ title: z.nullable(z.string()).optional(), role: z.nullable(z.string()).optional(), start_date: z.nullable(z.string().transform(v => new RFCDate(v))).optional(), end_date: z.nullable(z.string().transform(v => new RFCDate(v))).optional(), compensation_rate: z.nullable(z.number()).optional(), currency: z.nullable(Currency$inboundSchema).optional(), payment_unit: z.nullable(PaymentUnit$inboundSchema).optional(), hired_at: z.nullable(z.string().transform(v => new RFCDate(v))).optional(), is_primary: z.nullable(z.boolean()).optional(), is_manager: z.nullable(z.boolean()).optional(), status: z.nullable(EmployeeJobStatus$inboundSchema).optional(), location: Address$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "start_date": "startDate", "end_date": "endDate", "compensation_rate": "compensationRate", "payment_unit": "paymentUnit", "hired_at": "hiredAt", "is_primary": "isPrimary", "is_manager": "isManager", }); }); /** @internal */ export type EmployeeJobInput$Outbound = { title?: string | null | undefined; role?: string | null | undefined; start_date?: string | null | undefined; end_date?: string | null | undefined; compensation_rate?: number | null | undefined; currency?: string | null | undefined; payment_unit?: string | null | undefined; hired_at?: string | null | undefined; is_primary?: boolean | null | undefined; is_manager?: boolean | null | undefined; status?: string | null | undefined; location?: Address$Outbound | undefined; }; /** @internal */ export const EmployeeJobInput$outboundSchema: z.ZodType< EmployeeJobInput$Outbound, z.ZodTypeDef, EmployeeJobInput > = z.object({ title: z.nullable(z.string()).optional(), role: z.nullable(z.string()).optional(), startDate: z.nullable(z.instanceof(RFCDate).transform(v => v.toString())) .optional(), endDate: z.nullable(z.instanceof(RFCDate).transform(v => v.toString())) .optional(), compensationRate: z.nullable(z.number()).optional(), currency: z.nullable(Currency$outboundSchema).optional(), paymentUnit: z.nullable(PaymentUnit$outboundSchema).optional(), hiredAt: z.nullable(z.instanceof(RFCDate).transform(v => v.toString())) .optional(), isPrimary: z.nullable(z.boolean()).optional(), isManager: z.nullable(z.boolean()).optional(), status: z.nullable(EmployeeJobStatus$outboundSchema).optional(), location: Address$outboundSchema.optional(), }).transform((v) => { return remap$(v, { startDate: "start_date", endDate: "end_date", compensationRate: "compensation_rate", paymentUnit: "payment_unit", hiredAt: "hired_at", isPrimary: "is_primary", isManager: "is_manager", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace EmployeeJobInput$ { /** @deprecated use `EmployeeJobInput$inboundSchema` instead. */ export const inboundSchema = EmployeeJobInput$inboundSchema; /** @deprecated use `EmployeeJobInput$outboundSchema` instead. */ export const outboundSchema = EmployeeJobInput$outboundSchema; /** @deprecated use `EmployeeJobInput$Outbound` instead. */ export type Outbound = EmployeeJobInput$Outbound; } export function employeeJobInputToJSON( employeeJobInput: EmployeeJobInput, ): string { return JSON.stringify( EmployeeJobInput$outboundSchema.parse(employeeJobInput), ); } export function employeeJobInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmployeeJobInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmployeeJobInput' from JSON`, ); }