/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The type of recipient associated with the document (will be `Contractor` for Contractor Documents) */ export const DocumentSignedRecipientType = { Company: "Company", Employee: "Employee", Contractor: "Contractor", } as const; /** * The type of recipient associated with the document (will be `Contractor` for Contractor Documents) */ export type DocumentSignedRecipientType = ClosedEnum< typeof DocumentSignedRecipientType >; export type DocumentSignedPages = { /** * Image URL for the page */ imageUrl?: string | undefined; /** * Page number */ pageNumber?: number | undefined; }; export type DocumentSignedFields = { /** * Unique identifier of the field. May be null for custom fields that do not correspond to a known Gusto-managed key mapping. */ key?: string | null | undefined; /** * Value of the field */ value?: string | null | undefined; /** * X-coordinate location of the field on the page. May be null when the field has no positioning information. */ x?: number | null | undefined; /** * Y-coordinate location of the field on the page. May be null when the field has no positioning information. */ y?: number | null | undefined; /** * Width of the field. May be null when the field has no positioning information. */ width?: number | null | undefined; /** * Height of the field. May be null when the field has no positioning information. */ height?: number | null | undefined; /** * Page number of the field. May be null when the field has no positioning information. */ pageNumber?: number | null | undefined; /** * The field's data type */ dataType?: string | undefined; /** * Whether the field is required */ required?: boolean | undefined; }; export type DocumentSigned = { /** * The UUID of the document */ uuid?: string | undefined; /** * The title of the document */ title?: string | undefined; /** * The type identifier of the document */ name?: string | undefined; /** * The type of recipient associated with the document (will be `Contractor` for Contractor Documents) */ recipientType?: DocumentSignedRecipientType | undefined; /** * Unique identifier for the recipient associated with the document */ recipientUuid?: string | undefined; /** * List of the document's pages and associated image URLs. */ pages?: Array | undefined; /** * List of the document's fields and associated data. Values reflect the data provided at signing. */ fields?: Array | undefined; /** * When the document was signed (will be `null` if unsigned) */ signedAt?: string | null | undefined; /** * The description of the document */ description?: string | undefined; /** * A boolean flag that indicates whether the document needs signing or not. Note that this value will change after the document is signed. */ requiresSigning?: boolean | undefined; /** * If the document is in a draft state */ draft?: boolean | undefined; /** * The year of this document. This value is nullable and will not be present on all documents. */ year?: number | null | undefined; /** * The quarter of this document. This value is nullable and will not be present on all documents. */ quarter?: number | null | undefined; }; /** @internal */ export const DocumentSignedRecipientType$inboundSchema: z.ZodNativeEnum< typeof DocumentSignedRecipientType > = z.nativeEnum(DocumentSignedRecipientType); /** @internal */ export const DocumentSignedPages$inboundSchema: z.ZodType< DocumentSignedPages, z.ZodTypeDef, unknown > = z.object({ image_url: z.string().optional(), page_number: z.number().int().optional(), }).transform((v) => { return remap$(v, { "image_url": "imageUrl", "page_number": "pageNumber", }); }); export function documentSignedPagesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DocumentSignedPages$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DocumentSignedPages' from JSON`, ); } /** @internal */ export const DocumentSignedFields$inboundSchema: z.ZodType< DocumentSignedFields, z.ZodTypeDef, unknown > = z.object({ key: z.nullable(z.string()).optional(), value: z.nullable(z.string()).optional(), x: z.nullable(z.number().int()).optional(), y: z.nullable(z.number().int()).optional(), width: z.nullable(z.number().int()).optional(), height: z.nullable(z.number().int()).optional(), page_number: z.nullable(z.number().int()).optional(), data_type: z.string().optional(), required: z.boolean().optional(), }).transform((v) => { return remap$(v, { "page_number": "pageNumber", "data_type": "dataType", }); }); export function documentSignedFieldsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DocumentSignedFields$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DocumentSignedFields' from JSON`, ); } /** @internal */ export const DocumentSigned$inboundSchema: z.ZodType< DocumentSigned, z.ZodTypeDef, unknown > = z.object({ uuid: z.string().optional(), title: z.string().optional(), name: z.string().optional(), recipient_type: DocumentSignedRecipientType$inboundSchema.optional(), recipient_uuid: z.string().optional(), pages: z.array(z.lazy(() => DocumentSignedPages$inboundSchema)).optional(), fields: z.array(z.lazy(() => DocumentSignedFields$inboundSchema)).optional(), signed_at: z.nullable(z.string()).optional(), description: z.string().optional(), requires_signing: z.boolean().optional(), draft: z.boolean().optional(), year: z.nullable(z.number().int()).optional(), quarter: z.nullable(z.number().int()).optional(), }).transform((v) => { return remap$(v, { "recipient_type": "recipientType", "recipient_uuid": "recipientUuid", "signed_at": "signedAt", "requires_signing": "requiresSigning", }); }); export function documentSignedFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DocumentSigned$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DocumentSigned' from JSON`, ); }