/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { TaskStatus, TaskStatus$inboundSchema } from "./taskstatus.js"; import { TaskTypeCOMPLETEBACKGROUNDCHECKS, TaskTypeCOMPLETEBACKGROUNDCHECKS$inboundSchema, } from "./tasktypecompletebackgroundchecks.js"; /** * If the task is disabled, the reason and date when it was disabled. */ export type CompleteBackgroundChecksTaskSummaryDisabled = { date: Date; reason: string | null; }; /** * Task summary for completing background checks. */ export type CompleteBackgroundChecksTaskSummary = { taskType: TaskTypeCOMPLETEBACKGROUNDCHECKS; /** * The status of a task. * * @remarks * - COMPLETE: The task has been completed. * - DUE_SOON: The task is due soon. * - OVERDUE: The task is overdue. * - NONE: The task is not assigned. */ status: TaskStatus; /** * The due date of the task. */ dueDate: Date | null; /** * The date the task was completed. */ completionDate: Date | null; /** * If the task is disabled, the reason and date when it was disabled. */ disabled: CompleteBackgroundChecksTaskSummaryDisabled | null; }; /** @internal */ export const CompleteBackgroundChecksTaskSummaryDisabled$inboundSchema: z.ZodType< CompleteBackgroundChecksTaskSummaryDisabled, z.ZodTypeDef, unknown > = z.object({ date: z.string().datetime({ offset: true }).transform(v => new Date(v)), reason: z.nullable(z.string()), }); export function completeBackgroundChecksTaskSummaryDisabledFromJSON( jsonString: string, ): SafeParseResult< CompleteBackgroundChecksTaskSummaryDisabled, SDKValidationError > { return safeParse( jsonString, (x) => CompleteBackgroundChecksTaskSummaryDisabled$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'CompleteBackgroundChecksTaskSummaryDisabled' from JSON`, ); } /** @internal */ export const CompleteBackgroundChecksTaskSummary$inboundSchema: z.ZodType< CompleteBackgroundChecksTaskSummary, z.ZodTypeDef, unknown > = z.object({ taskType: TaskTypeCOMPLETEBACKGROUNDCHECKS$inboundSchema, status: TaskStatus$inboundSchema, dueDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), completionDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), disabled: z.nullable( z.lazy(() => CompleteBackgroundChecksTaskSummaryDisabled$inboundSchema), ), }); export function completeBackgroundChecksTaskSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompleteBackgroundChecksTaskSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompleteBackgroundChecksTaskSummary' from JSON`, ); }