/* * 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 { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; export const ApplicationStatus = { Open: "open", Rejected: "rejected", Hired: "hired", Converted: "converted", Other: "other", } as const; export type ApplicationStatus = OpenEnum; export type Stage = { /** * Stage the candidate should be in. If omitted, the default stage for this job will be used. */ id?: string | null | undefined; name?: string | null | undefined; }; export type Application = { /** * A unique identifier for an object. */ id?: string | undefined; applicantId: string | null; jobId: string | null; status?: ApplicationStatus | null | undefined; stage?: Stage | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | 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 ApplicationInput = { applicantId: string | null; jobId: string | null; status?: ApplicationStatus | null | undefined; stage?: Stage | 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 ApplicationStatus$inboundSchema: z.ZodType< ApplicationStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ApplicationStatus) ); /** @internal */ export const ApplicationStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, ApplicationStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ApplicationStatus) ); /** @internal */ export const Stage$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(types.string()).optional(), name: z.nullable(types.string()).optional(), }) ); /** @internal */ export type Stage$Outbound = { id?: string | null | undefined; name?: string | null | undefined; }; /** @internal */ export const Stage$outboundSchema: z.ZodType< Stage$Outbound, z.ZodTypeDef, Stage > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), }) ); export function stageToJSON(stage: Stage): string { return JSON.stringify(Stage$outboundSchema.parse(stage)); } export function stageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Stage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Stage' from JSON`, ); } /** @internal */ export const Application$inboundSchema: z.ZodType< Application, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), applicant_id: types.nullable(types.string()), job_id: types.nullable(types.string()), status: z.nullable(ApplicationStatus$inboundSchema).optional(), stage: types.optional(z.lazy(() => Stage$inboundSchema)), custom_mappings: z.nullable(z.record(z.any())).optional(), updated_by: z.nullable(types.string()).optional(), created_by: 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, { "applicant_id": "applicantId", "job_id": "jobId", "custom_mappings": "customMappings", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function applicationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Application$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Application' from JSON`, ); } /** @internal */ export type ApplicationInput$Outbound = { applicant_id: string | null; job_id: string | null; status?: string | null | undefined; stage?: Stage$Outbound | undefined; pass_through?: Array | undefined; }; /** @internal */ export const ApplicationInput$outboundSchema: z.ZodType< ApplicationInput$Outbound, z.ZodTypeDef, ApplicationInput > = /* @__PURE__ */ lazySchema$(() => z.object({ applicantId: z.nullable(z.string()), jobId: z.nullable(z.string()), status: z.nullable(ApplicationStatus$outboundSchema).optional(), stage: z.lazy(() => Stage$outboundSchema).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { applicantId: "applicant_id", jobId: "job_id", passThrough: "pass_through", }); }) ); export function applicationInputToJSON( applicationInput: ApplicationInput, ): string { return JSON.stringify( ApplicationInput$outboundSchema.parse(applicationInput), ); }