/* * 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 { CustomTask, CustomTask$inboundSchema } from "./customtask.js"; import { TaskStatus, TaskStatus$inboundSchema } from "./taskstatus.js"; import { TaskTypeCOMPLETECUSTOMTASKS, TaskTypeCOMPLETECUSTOMTASKS$inboundSchema, } from "./tasktypecompletecustomtasks.js"; /** * If the task is disabled, the reason and date when it was disabled. */ export type CompleteCustomTasksTaskSummaryDisabled = { date: Date; reason: string | null; }; /** * Task summary for completing all custom tasks. */ export type CompleteCustomTasksTaskSummary = { taskType: TaskTypeCOMPLETECUSTOMTASKS; /** * 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: CompleteCustomTasksTaskSummaryDisabled | null; /** * Incomplete custom tasks that are relevant given a person's requirements. */ incompleteCustomTasks: Array; /** * Custom tasks that have been completed and are relevant given a person's current requirements. */ completedCustomTasks: Array; }; /** @internal */ export const CompleteCustomTasksTaskSummaryDisabled$inboundSchema: z.ZodType< CompleteCustomTasksTaskSummaryDisabled, z.ZodTypeDef, unknown > = z.object({ date: z.string().datetime({ offset: true }).transform(v => new Date(v)), reason: z.nullable(z.string()), }); export function completeCustomTasksTaskSummaryDisabledFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompleteCustomTasksTaskSummaryDisabled$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompleteCustomTasksTaskSummaryDisabled' from JSON`, ); } /** @internal */ export const CompleteCustomTasksTaskSummary$inboundSchema: z.ZodType< CompleteCustomTasksTaskSummary, z.ZodTypeDef, unknown > = z.object({ taskType: TaskTypeCOMPLETECUSTOMTASKS$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(() => CompleteCustomTasksTaskSummaryDisabled$inboundSchema), ), incompleteCustomTasks: z.array(CustomTask$inboundSchema), completedCustomTasks: z.array(CustomTask$inboundSchema), }); export function completeCustomTasksTaskSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompleteCustomTasksTaskSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompleteCustomTasksTaskSummary' from JSON`, ); }