/* * 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 { AuditSegmentFramework, AuditSegmentFramework$inboundSchema, } from "./auditsegmentframework.js"; import { AuditSegmentKind, AuditSegmentKind$inboundSchema, } from "./auditsegmentkind.js"; import { AuditSoc2ReportType, AuditSoc2ReportType$inboundSchema, } from "./auditsoc2reporttype.js"; import { AuditSoc2Tsc, AuditSoc2Tsc$inboundSchema } from "./auditsoc2tsc.js"; /** * The business unit this program segment is scoped to, or null when the * * @remarks * segment is not BU-scoped or the BU cannot be resolved. */ export type BusinessUnit = { /** * The unique identifier of the associated business unit or information system. */ id: string; /** * The human-readable name of the associated business unit or information system. */ displayName: string; }; /** * The information system this system segment is scoped to, or null on * * @remarks * program segments. */ export type System = { /** * The unique identifier of the associated business unit or information system. */ id: string; /** * The human-readable name of the associated business unit or information system. */ displayName: string; }; /** * SOC 2 report type and Trust Services Criteria for this segment, or null. */ export type Soc2Deliverable = { reportType: AuditSoc2ReportType; /** * Trust Services Criteria this segment covers. */ tscs: Array; }; /** * One segment of an audit's scope. A live audit returns every in-scope program * * @remarks * and system segment; more than one segment does not by itself imply more than * one framework. Soft-deleted audits return an empty list. `displayName` is the * segment label owned by audit scope * (for example "{Framework}" or "{Framework} — {Business Unit}"). * `soc2Deliverable` is the per-segment SOC 2 config, or null. `businessUnit` * is set for program segments that are BU-scoped and null otherwise. `system` * is set for system segments and null otherwise. */ export type AuditSegment = { /** * The unique identifier for the segment. */ id: string; kind: AuditSegmentKind; /** * The segment's display label. Do not reconstruct this from framework + BU. */ displayName: string; /** * The framework this segment is in. */ framework: AuditSegmentFramework; /** * The business unit this program segment is scoped to, or null when the * * @remarks * segment is not BU-scoped or the BU cannot be resolved. */ businessUnit: BusinessUnit | null; /** * The information system this system segment is scoped to, or null on * * @remarks * program segments. */ system: System | null; /** * SOC 2 report type and Trust Services Criteria for this segment, or null. */ soc2Deliverable: Soc2Deliverable | null; }; /** @internal */ export const BusinessUnit$inboundSchema: z.ZodType< BusinessUnit, z.ZodTypeDef, unknown > = z.object({ id: z.string(), displayName: z.string(), }); export function businessUnitFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BusinessUnit$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BusinessUnit' from JSON`, ); } /** @internal */ export const System$inboundSchema: z.ZodType = z .object({ id: z.string(), displayName: z.string(), }); export function systemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => System$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'System' from JSON`, ); } /** @internal */ export const Soc2Deliverable$inboundSchema: z.ZodType< Soc2Deliverable, z.ZodTypeDef, unknown > = z.object({ reportType: AuditSoc2ReportType$inboundSchema, tscs: z.array(AuditSoc2Tsc$inboundSchema), }); export function soc2DeliverableFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Soc2Deliverable$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Soc2Deliverable' from JSON`, ); } /** @internal */ export const AuditSegment$inboundSchema: z.ZodType< AuditSegment, z.ZodTypeDef, unknown > = z.object({ id: z.string(), kind: AuditSegmentKind$inboundSchema, displayName: z.string(), framework: AuditSegmentFramework$inboundSchema, businessUnit: z.nullable(z.lazy(() => BusinessUnit$inboundSchema)), system: z.nullable(z.lazy(() => System$inboundSchema)), soc2Deliverable: z.nullable(z.lazy(() => Soc2Deliverable$inboundSchema)), }); export function auditSegmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuditSegment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuditSegment' from JSON`, ); }