/* * 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 { ControlSource, ControlSource$inboundSchema } from "./controlsource.js"; import { CustomField, CustomField$inboundSchema } from "./customfield.js"; /** * The control's owner. */ export type AuditorApiControlOwner = { /** * Unique identifier for the person. */ id: string; /** * Name of the person that is shown in product. */ displayName: string; /** * Email address of the person. */ emailAddress: string; }; export type AuditorApiControl = { /** * The control's unique ID. */ id: string; /** * The control's external ID. */ externalId: string | null; /** * The control's name. */ name: string; /** * The control's description. */ description: string; source: ControlSource; /** * The security domains that the control belongs to. */ domains: Array; /** * The control's owner. */ owner: AuditorApiControlOwner | null; /** * The control's GDPR role, if the control is a GDPR control. */ role?: string | null | undefined; /** * The control's custom field values, if control custom fields is included in your Vanta instance. */ customFields: Array; /** * When the control was created. Returns null for Vanta library controls. */ creationDate: Date | null; /** * When the control was last modified. Returns null for Vanta library controls. */ modificationDate: Date | null; }; /** @internal */ export const AuditorApiControlOwner$inboundSchema: z.ZodType< AuditorApiControlOwner, z.ZodTypeDef, unknown > = z.object({ id: z.string(), displayName: z.string(), emailAddress: z.string(), }); export function auditorApiControlOwnerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuditorApiControlOwner$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuditorApiControlOwner' from JSON`, ); } /** @internal */ export const AuditorApiControl$inboundSchema: z.ZodType< AuditorApiControl, z.ZodTypeDef, unknown > = z.object({ id: z.string(), externalId: z.nullable(z.string()), name: z.string(), description: z.string(), source: ControlSource$inboundSchema, domains: z.array(z.string()), owner: z.nullable(z.lazy(() => AuditorApiControlOwner$inboundSchema)), role: z.nullable(z.string()).optional(), customFields: z.array(CustomField$inboundSchema), creationDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), modificationDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), }); export function auditorApiControlFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuditorApiControl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuditorApiControl' from JSON`, ); }