/* * 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 { AuditVendorRiskLevel, AuditVendorRiskLevel$inboundSchema, } from "./auditvendorrisklevel.js"; import { AuditVendorStatus, AuditVendorStatus$inboundSchema, } from "./auditvendorstatus.js"; /** * Residual risk level of the vendor. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ export const ResidualRisk = { Critical: "CRITICAL", High: "HIGH", Medium: "MEDIUM", Low: "LOW", Unscored: "UNSCORED", } as const; /** * Residual risk level of the vendor. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ export type ResidualRisk = ClosedEnum; /** * BAA/DPA document completion counts, or null if no such documents are required. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ export type DataAgreements = { total: number; complete: number; }; /** * Managed vendor row returned by the auditor managed-vendors API. * * @remarks * * Only `id` and `name` are required. All other fields are optional to support * controlled audits where only approved columns are returned and * customizable field visibility. */ export type AuditVendor = { /** * Vendor record ID. */ id: string; /** * Vendor name. */ name: string; /** * IDs of the audit segments this vendor is in scope for. * * @remarks * Omitted when segment scoping is disabled. */ segmentIds?: Array | undefined; inherentRisk?: AuditVendorRiskLevel | undefined; status?: AuditVendorStatus | undefined; /** * Number of findings associated with the vendor. */ findings?: number | undefined; /** * Date when the last security review was completed, or null if none. */ lastReviewedCompleted?: Date | null | undefined; /** * Date when the next security review is due, or null if not scheduled. */ nextSecurityReviewDueDate?: Date | null | undefined; /** * Vendor category (e.g. cloud provider, SaaS). * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ vendorCategory?: string | null | undefined; /** * ID of the vendor's category. */ vendorCategoryId?: string | null | undefined; /** * Residual risk level of the vendor. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ residualRisk?: ResidualRisk | null | undefined; /** * BAA/DPA document completion counts, or null if no such documents are required. * * @remarks * Full Audit View only - omitted in Controlled Audit View. */ dataAgreements?: DataAgreements | null | undefined; }; /** @internal */ export const ResidualRisk$inboundSchema: z.ZodNativeEnum = z.nativeEnum(ResidualRisk); /** @internal */ export const DataAgreements$inboundSchema: z.ZodType< DataAgreements, z.ZodTypeDef, unknown > = z.object({ total: z.number(), complete: z.number(), }); export function dataAgreementsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DataAgreements$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DataAgreements' from JSON`, ); } /** @internal */ export const AuditVendor$inboundSchema: z.ZodType< AuditVendor, z.ZodTypeDef, unknown > = z.object({ id: z.string(), name: z.string(), segmentIds: z.array(z.string()).optional(), inherentRisk: AuditVendorRiskLevel$inboundSchema.optional(), status: AuditVendorStatus$inboundSchema.optional(), findings: z.number().optional(), lastReviewedCompleted: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), nextSecurityReviewDueDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), vendorCategory: z.nullable(z.string()).optional(), vendorCategoryId: z.nullable(z.string()).optional(), residualRisk: z.nullable(ResidualRisk$inboundSchema).optional(), dataAgreements: z.nullable(z.lazy(() => DataAgreements$inboundSchema)) .optional(), }); export function auditVendorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuditVendor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuditVendor' from JSON`, ); }