/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; import { PeopleSecurityTaskStatus, PeopleSecurityTaskStatus$inboundSchema, } from "./peoplesecuritytaskstatus.js"; import { PeopleTaskStatus, PeopleTaskStatus$inboundSchema, } from "./peopletaskstatus.js"; /** * Employment status, or null if not available. */ export const PersonnelPersonEmploymentStatus = { CurrentlyEmployed: "CURRENTLY_EMPLOYED", InactiveEmployee: "INACTIVE_EMPLOYEE", NotPeople: "NOT_PEOPLE", OnLeave: "ON_LEAVE", PreviouslyEmployed: "PREVIOUSLY_EMPLOYED", UpcomingEmployee: "UPCOMING_EMPLOYEE", } as const; /** * Employment status, or null if not available. */ export type PersonnelPersonEmploymentStatus = ClosedEnum< typeof PersonnelPersonEmploymentStatus >; export type Groups = { name: string; }; /** * Source of user data, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ export type Source = { /** * Main source of user data. */ mainSource: string; /** * Supplementary source, or null if none. */ supplementarySource: string | null; }; /** * Overall task status information, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ export type PersonnelPersonTaskStatus = { /** * Overall user task status. */ status: PeopleTaskStatus; /** * Due date for the earliest incomplete task in ISO 8601 format, or null if none. */ dueDate: string | null; /** * Completion date when all tasks are complete in ISO 8601 format, or null if incomplete. */ completionDate: string | null; /** * Count of completed tasks, or null if not available. */ numTasksCompleted: number | null; /** * Count of overdue tasks, or null if not available. */ numTasksOverdue: number | null; /** * Count of tasks due soon, or null if not available. */ numTasksDueSoon: number | null; }; /** * Policy acceptance task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ export type Policies = { /** * Security task status for individual task categories. */ status: PeopleSecurityTaskStatus; /** * Due date for incomplete task in ISO 8601 format, or null if none. */ dueDate: string | null; /** * Completion date for completed task in ISO 8601 format, or null if incomplete. */ completionDate: string | null; }; /** * Security training task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ export type Trainings = { /** * Security task status for individual task categories. */ status: PeopleSecurityTaskStatus; /** * Due date for incomplete task in ISO 8601 format, or null if none. */ dueDate: string | null; /** * Completion date for completed task in ISO 8601 format, or null if incomplete. */ completionDate: string | null; }; /** * Background check task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ export type BackgroundChecks = { /** * Security task status for individual task categories. */ status: PeopleSecurityTaskStatus; /** * Due date for incomplete task in ISO 8601 format, or null if none. */ dueDate: string | null; /** * Completion date for completed task in ISO 8601 format, or null if incomplete. */ completionDate: string | null; }; /** * Device monitoring task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ export type DeviceMonitoring = { /** * Security task status for individual task categories. */ status: PeopleSecurityTaskStatus; /** * Due date for incomplete task in ISO 8601 format, or null if none. */ dueDate: string | null; /** * Completion date for completed task in ISO 8601 format, or null if incomplete. */ completionDate: string | null; }; /** * Custom onboarding task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ export type CustomOnboarding = { /** * Security task status for individual task categories. */ status: PeopleSecurityTaskStatus; /** * Due date for incomplete task in ISO 8601 format, or null if none. */ dueDate: string | null; /** * Completion date for completed task in ISO 8601 format, or null if incomplete. */ completionDate: string | null; }; /** * Custom offboarding task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ export type CustomOffboarding = { /** * Security task status for individual task categories. */ status: PeopleSecurityTaskStatus; /** * Due date for incomplete task in ISO 8601 format, or null if none. */ dueDate: string | null; /** * Completion date for completed task in ISO 8601 format, or null if incomplete. */ completionDate: string | null; }; /** * Personnel person data. * * @remarks * * `id`, `name`, and `email` are required. All other fields are optional to support customizable field visibility. * * Omitted keys mean the column is not in the response; `null` means the column is present but empty. */ export type PersonnelPerson = { /** * User ID - always present. */ id: string; /** * Display name of the person - always present. */ name: string; /** * Email address of the person - always present. */ email: string; /** * IDs of the audit segments this person is in scope for. * * @remarks * Omitted when segment scoping is disabled. */ segmentIds?: Array | undefined; /** * Job title from HR system, or null if not available. */ jobTitle?: string | null | undefined; /** * Employment status, or null if not available. */ employmentStatus?: PersonnelPersonEmploymentStatus | null | undefined; /** * Start date in ISO 8601 format (YYYY-MM-DD), or null if not available. * * @remarks * Timezone depends on source: UTC if from HR system, * customer timezone if manually entered. */ startDate?: string | null | undefined; /** * End date in ISO 8601 format (YYYY-MM-DD), or null if currently employed. */ endDate?: string | null | undefined; /** * Groups (roles) the person belongs to. Present only when the column is in the response; * * @remarks * use an empty array when there are no groups. */ groups?: Array | undefined; /** * Source of user data, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ source?: Source | null | undefined; /** * Overall task status information, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ taskStatus?: PersonnelPersonTaskStatus | null | undefined; /** * Last date user was sent an onboarding reminder email in ISO 8601 format, or null if never reminded. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ lastReminded?: string | null | undefined; /** * Policy acceptance task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ policies?: Policies | null | undefined; /** * Security training task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ trainings?: Trainings | null | undefined; /** * Background check task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ backgroundChecks?: BackgroundChecks | null | undefined; /** * Device monitoring task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ deviceMonitoring?: DeviceMonitoring | null | undefined; /** * Custom onboarding task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ customOnboarding?: CustomOnboarding | null | undefined; /** * Custom offboarding task details, or null if not available. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ customOffboarding?: CustomOffboarding | null | undefined; }; /** @internal */ export const PersonnelPersonEmploymentStatus$inboundSchema: z.ZodNativeEnum< typeof PersonnelPersonEmploymentStatus > = z.nativeEnum(PersonnelPersonEmploymentStatus); /** @internal */ export const Groups$inboundSchema: z.ZodType = z .object({ name: z.string(), }); export function groupsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Groups$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Groups' from JSON`, ); } /** @internal */ export const Source$inboundSchema: z.ZodType = z .object({ mainSource: z.string(), supplementarySource: z.nullable(z.string()), }); export function sourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Source$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Source' from JSON`, ); } /** @internal */ export const PersonnelPersonTaskStatus$inboundSchema: z.ZodType< PersonnelPersonTaskStatus, z.ZodTypeDef, unknown > = z.object({ status: PeopleTaskStatus$inboundSchema, dueDate: z.nullable(z.string()), completionDate: z.nullable(z.string()), numTasksCompleted: z.nullable(z.number()), numTasksOverdue: z.nullable(z.number()), numTasksDueSoon: z.nullable(z.number()), }); export function personnelPersonTaskStatusFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PersonnelPersonTaskStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PersonnelPersonTaskStatus' from JSON`, ); } /** @internal */ export const Policies$inboundSchema: z.ZodType< Policies, z.ZodTypeDef, unknown > = z.object({ status: PeopleSecurityTaskStatus$inboundSchema, dueDate: z.nullable(z.string()), completionDate: z.nullable(z.string()), }); export function policiesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Policies$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Policies' from JSON`, ); } /** @internal */ export const Trainings$inboundSchema: z.ZodType< Trainings, z.ZodTypeDef, unknown > = z.object({ status: PeopleSecurityTaskStatus$inboundSchema, dueDate: z.nullable(z.string()), completionDate: z.nullable(z.string()), }); export function trainingsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Trainings$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Trainings' from JSON`, ); } /** @internal */ export const BackgroundChecks$inboundSchema: z.ZodType< BackgroundChecks, z.ZodTypeDef, unknown > = z.object({ status: PeopleSecurityTaskStatus$inboundSchema, dueDate: z.nullable(z.string()), completionDate: z.nullable(z.string()), }); export function backgroundChecksFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BackgroundChecks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BackgroundChecks' from JSON`, ); } /** @internal */ export const DeviceMonitoring$inboundSchema: z.ZodType< DeviceMonitoring, z.ZodTypeDef, unknown > = z.object({ status: PeopleSecurityTaskStatus$inboundSchema, dueDate: z.nullable(z.string()), completionDate: z.nullable(z.string()), }); export function deviceMonitoringFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DeviceMonitoring$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeviceMonitoring' from JSON`, ); } /** @internal */ export const CustomOnboarding$inboundSchema: z.ZodType< CustomOnboarding, z.ZodTypeDef, unknown > = z.object({ status: PeopleSecurityTaskStatus$inboundSchema, dueDate: z.nullable(z.string()), completionDate: z.nullable(z.string()), }); export function customOnboardingFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomOnboarding$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomOnboarding' from JSON`, ); } /** @internal */ export const CustomOffboarding$inboundSchema: z.ZodType< CustomOffboarding, z.ZodTypeDef, unknown > = z.object({ status: PeopleSecurityTaskStatus$inboundSchema, dueDate: z.nullable(z.string()), completionDate: z.nullable(z.string()), }); export function customOffboardingFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomOffboarding$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomOffboarding' from JSON`, ); } /** @internal */ export const PersonnelPerson$inboundSchema: z.ZodType< PersonnelPerson, z.ZodTypeDef, unknown > = z.object({ id: z.string(), name: z.string(), email: z.string(), segmentIds: z.array(z.string()).optional(), jobTitle: z.nullable(z.string()).optional(), employmentStatus: z.nullable(PersonnelPersonEmploymentStatus$inboundSchema) .optional(), startDate: z.nullable(z.string()).optional(), endDate: z.nullable(z.string()).optional(), groups: z.array(z.lazy(() => Groups$inboundSchema)).optional(), source: z.nullable(z.lazy(() => Source$inboundSchema)).optional(), taskStatus: z.nullable(z.lazy(() => PersonnelPersonTaskStatus$inboundSchema)) .optional(), lastReminded: z.nullable(z.string()).optional(), policies: z.nullable(z.lazy(() => Policies$inboundSchema)).optional(), trainings: z.nullable(z.lazy(() => Trainings$inboundSchema)).optional(), backgroundChecks: z.nullable(z.lazy(() => BackgroundChecks$inboundSchema)) .optional(), deviceMonitoring: z.nullable(z.lazy(() => DeviceMonitoring$inboundSchema)) .optional(), customOnboarding: z.nullable(z.lazy(() => CustomOnboarding$inboundSchema)) .optional(), customOffboarding: z.nullable(z.lazy(() => CustomOffboarding$inboundSchema)) .optional(), }); export function personnelPersonFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PersonnelPerson$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PersonnelPerson' from JSON`, ); }