/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export enum MatchAttributes { MatchAttributeUnspecified = "MATCH_ATTRIBUTE_UNSPECIFIED", Name = "NAME", PhoneNumber = "PHONE_NUMBER", BirthDate = "BIRTH_DATE", Identification = "IDENTIFICATION", Email = "EMAIL", Address = "ADDRESS", } export type MatchAttributesOpen = OpenEnum; /** * The match state for a profile, one of: * * @remarks * - `MATCH_UNSPECIFIED` - Default/Null value. * - `CONFIRMED_MATCH` - Match is confirmed. * - `POTENTIAL_MATCH` - Match is a potential. * - `NO_MATCH` - Match is confirmed not to be a match. * - `INCONCLUSIVE` - Match is deemed to be inconclusive. */ export enum MatchState { MatchUnspecified = "MATCH_UNSPECIFIED", ConfirmedMatch = "CONFIRMED_MATCH", PotentialMatch = "POTENTIAL_MATCH", NoMatch = "NO_MATCH", Inconclusive = "INCONCLUSIVE", } /** * The match state for a profile, one of: * * @remarks * - `MATCH_UNSPECIFIED` - Default/Null value. * - `CONFIRMED_MATCH` - Match is confirmed. * - `POTENTIAL_MATCH` - Match is a potential. * - `NO_MATCH` - Match is confirmed not to be a match. * - `INCONCLUSIVE` - Match is deemed to be inconclusive. */ export type MatchStateOpen = OpenEnum; export enum MatchTypes { MatchTypeUnspecified = "MATCH_TYPE_UNSPECIFIED", NonOfacSanctions = "NON_OFAC_SANCTIONS", RelativeOrCloseAssociate = "RELATIVE_OR_CLOSE_ASSOCIATE", OfacSanctions = "OFAC_SANCTIONS", PoliticallyExposedPerson = "POLITICALLY_EXPOSED_PERSON", Dndb = "DNDB", NegativeNews = "NEGATIVE_NEWS", } export type MatchTypesOpen = OpenEnum; /** * Matched profile details */ export type WatchlistMatch = { /** * Identifies if the entry is active or not */ active?: boolean | undefined; /** * The time the watchlist match was created */ createdAt?: Date | null | undefined; /** * Identifies that a confirmed watchlist match can be excluded when calculating the related screen state */ excludeFromScreening?: boolean | undefined; /** * The attributes used in watchlist screening, one of: * * @remarks * - `MATCH_ATTRIBUTE_UNSPECIFIED` - Default/Null value. * - `NAME` - Matched on name. * - `PHONE_NUMBER` - Matched on phone number. * - `BIRTH_DATE` - Matched on birth date. * - `IDENTIFICATION` - Matched on identification. * - `EMAIL` - Matched on email. * - `ADDRESS` - Matched on address. */ matchAttributes?: Array | undefined; /** * The match state for a profile, one of: * * @remarks * - `MATCH_UNSPECIFIED` - Default/Null value. * - `CONFIRMED_MATCH` - Match is confirmed. * - `POTENTIAL_MATCH` - Match is a potential. * - `NO_MATCH` - Match is confirmed not to be a match. * - `INCONCLUSIVE` - Match is deemed to be inconclusive. */ matchState?: MatchStateOpen | undefined; /** * The type of watchlist match, one of: * * @remarks * - `MATCH_TYPE_UNSPECIFIED` - Default/Null value. * - `NON_OFAC_SANCTIONS` - Matched on a non OFAC sanctions list. * - `RELATIVE_OR_CLOSE_ASSOCIATE` - Matched on a relative or close associate. * - `OFAC_SANCTIONS` - Matched on a OFAC sanctions list. * - `POLITICALLY_EXPOSED_PERSON` - Matched on a politically exposed person list. * - `DNDB` - Matched on a do not do business list. * - `NEGATIVE_NEWS` - Matched on a negative news list. */ matchTypes?: Array | undefined; /** * The time the watchlist match was last updated */ updatedAt?: Date | null | undefined; /** * Indicates the watchlist source for a given match */ watchlistId?: string | undefined; /** * Identification number for the watchlist item that was matched */ watchlistItemId?: number | undefined; }; /** @internal */ export const MatchAttributes$inboundSchema: z.ZodType< MatchAttributesOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(MatchAttributes), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const MatchAttributes$outboundSchema: z.ZodType< MatchAttributesOpen, z.ZodTypeDef, MatchAttributesOpen > = z.union([ z.nativeEnum(MatchAttributes), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace MatchAttributes$ { /** @deprecated use `MatchAttributes$inboundSchema` instead. */ export const inboundSchema = MatchAttributes$inboundSchema; /** @deprecated use `MatchAttributes$outboundSchema` instead. */ export const outboundSchema = MatchAttributes$outboundSchema; } /** @internal */ export const MatchState$inboundSchema: z.ZodType< MatchStateOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(MatchState), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const MatchState$outboundSchema: z.ZodType< MatchStateOpen, z.ZodTypeDef, MatchStateOpen > = z.union([ z.nativeEnum(MatchState), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace MatchState$ { /** @deprecated use `MatchState$inboundSchema` instead. */ export const inboundSchema = MatchState$inboundSchema; /** @deprecated use `MatchState$outboundSchema` instead. */ export const outboundSchema = MatchState$outboundSchema; } /** @internal */ export const MatchTypes$inboundSchema: z.ZodType< MatchTypesOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(MatchTypes), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const MatchTypes$outboundSchema: z.ZodType< MatchTypesOpen, z.ZodTypeDef, MatchTypesOpen > = z.union([ z.nativeEnum(MatchTypes), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace MatchTypes$ { /** @deprecated use `MatchTypes$inboundSchema` instead. */ export const inboundSchema = MatchTypes$inboundSchema; /** @deprecated use `MatchTypes$outboundSchema` instead. */ export const outboundSchema = MatchTypes$outboundSchema; } /** @internal */ export const WatchlistMatch$inboundSchema: z.ZodType< WatchlistMatch, z.ZodTypeDef, unknown > = z.object({ active: z.boolean().optional(), created_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), exclude_from_screening: z.boolean().optional(), match_attributes: z.array(MatchAttributes$inboundSchema).optional(), match_state: MatchState$inboundSchema.optional(), match_types: z.array(MatchTypes$inboundSchema).optional(), updated_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), watchlist_id: z.string().optional(), watchlist_item_id: z.number().int().optional(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", "exclude_from_screening": "excludeFromScreening", "match_attributes": "matchAttributes", "match_state": "matchState", "match_types": "matchTypes", "updated_at": "updatedAt", "watchlist_id": "watchlistId", "watchlist_item_id": "watchlistItemId", }); }); /** @internal */ export type WatchlistMatch$Outbound = { active?: boolean | undefined; created_at?: string | null | undefined; exclude_from_screening?: boolean | undefined; match_attributes?: Array | undefined; match_state?: string | undefined; match_types?: Array | undefined; updated_at?: string | null | undefined; watchlist_id?: string | undefined; watchlist_item_id?: number | undefined; }; /** @internal */ export const WatchlistMatch$outboundSchema: z.ZodType< WatchlistMatch$Outbound, z.ZodTypeDef, WatchlistMatch > = z.object({ active: z.boolean().optional(), createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), excludeFromScreening: z.boolean().optional(), matchAttributes: z.array(MatchAttributes$outboundSchema).optional(), matchState: MatchState$outboundSchema.optional(), matchTypes: z.array(MatchTypes$outboundSchema).optional(), updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), watchlistId: z.string().optional(), watchlistItemId: z.number().int().optional(), }).transform((v) => { return remap$(v, { createdAt: "created_at", excludeFromScreening: "exclude_from_screening", matchAttributes: "match_attributes", matchState: "match_state", matchTypes: "match_types", updatedAt: "updated_at", watchlistId: "watchlist_id", watchlistItemId: "watchlist_item_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace WatchlistMatch$ { /** @deprecated use `WatchlistMatch$inboundSchema` instead. */ export const inboundSchema = WatchlistMatch$inboundSchema; /** @deprecated use `WatchlistMatch$outboundSchema` instead. */ export const outboundSchema = WatchlistMatch$outboundSchema; /** @deprecated use `WatchlistMatch$Outbound` instead. */ export type Outbound = WatchlistMatch$Outbound; } export function watchlistMatchToJSON(watchlistMatch: WatchlistMatch): string { return JSON.stringify(WatchlistMatch$outboundSchema.parse(watchlistMatch)); } export function watchlistMatchFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WatchlistMatch$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WatchlistMatch' from JSON`, ); }