/* * 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"; /** * Name of the parent resource of the described entity. */ export const ResourceType = { Company: "Company", } as const; /** * Name of the parent resource of the described entity. */ export type ResourceType = ClosedEnum; /** * Representation of an Event */ export type Event = { /** * Unique identifier for the event. */ uuid: string; /** * Description of the event (e.g., payroll.submitted, or company.form.signed). */ eventType?: string | undefined; /** * Name of the parent resource of the described entity. */ resourceType?: ResourceType | undefined; /** * Unique identifier for the parent resource. */ resourceUuid?: string | undefined; /** * Name of the entity that the event corresponds to. */ entityType?: string | undefined; /** * Unique identifier for the entity. */ entityUuid?: string | undefined; /** * Time at which this event was created. Measured in seconds since the Unix epoch. */ timestamp?: number | undefined; }; /** @internal */ export const ResourceType$inboundSchema: z.ZodNativeEnum = z.nativeEnum(ResourceType); /** @internal */ export const Event$inboundSchema: z.ZodType = z .object({ uuid: z.string(), event_type: z.string().optional(), resource_type: ResourceType$inboundSchema.optional(), resource_uuid: z.string().optional(), entity_type: z.string().optional(), entity_uuid: z.string().optional(), timestamp: z.number().int().optional(), }).transform((v) => { return remap$(v, { "event_type": "eventType", "resource_type": "resourceType", "resource_uuid": "resourceUuid", "entity_type": "entityType", "entity_uuid": "entityUuid", }); }); export function eventFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Event$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Event' from JSON`, ); }