/** * Base Client Model * * Pure data model with no API calls. * Provides type-safe access to common client properties. */ import type { AddressResponse, BankAccountResponse, BaseClient, ClientRelationshipType, ContactMethodResponse, DocumentResponse, EmbeddedTag, Employment, LinkedClientResponse, RiskAssessmentSnapshot, RiskAssessments, Scope } from "@artu-ai/shared"; import { ClientType } from "@artu-ai/shared"; import { Address } from "./Address"; import { BankAccount } from "./BankAccount"; import { BaseModel } from "./base"; import { ContactMethod } from "./ContactMethod"; import { Document } from "./Document"; export type ClientData = BaseClient & { id: string; createdAt: string; updatedAt: string; email?: string | null; phone?: string | null; age?: number | null; addresses?: AddressResponse[]; contactMethods?: ContactMethodResponse[]; bankAccounts?: BankAccountResponse[]; documents?: DocumentResponse[]; linkedClients?: LinkedClientResponse[]; riskAssessments?: RiskAssessments; tags?: EmbeddedTag[]; }; /** * Base Client Model. * * Pure data model with no API calls. * Extended by scope-specific models (MexClient, etc.). * * @example * ```typescript * const client = await sdk.clients.retrieve("client_123"); * console.log(client.name); * console.log(client.email); * ``` */ export declare class Client extends BaseModel { /** * Unique identifier */ get id(): string; /** * Client type: "individual" or "company" */ get type(): ClientType; /** * Whether this is an individual (individual) */ get isIndividual(): boolean; /** * Whether this is a company (legal entity) */ get isCompany(): boolean; /** * Whether this is a trust */ get isTrust(): boolean; /** * First name (individual) or legal name (company/trust) */ get name(): string; /** * Full display name. * For individuals: constructs "firstName middleName lastName" from components. * For companies/trusts: returns the legal name. */ get displayName(): string; /** * Nationalities as ISO2 country codes */ get nationalities(): string[]; /** * Birth date (individuals only) * Returns undefined for companies and trusts */ get birthDate(): Date | undefined; /** * Middle name (individuals only) */ get middleName(): string | undefined; /** * Last name(s) (individuals only) * Returns as array to support multiple surnames (e.g., Spanish naming) */ get lastName(): string[] | undefined; /** * Employment information (individuals only) * Contains isEmployee flag and optional details like employeeId, position, department, startDate */ get employment(): Employment | undefined; /** * Incorporation date (companies only) * Returns undefined for individuals and trusts */ get incorporationDate(): Date | undefined; /** * Commercial or trade name (companies only) * Returns undefined for individuals and trusts */ get commercialName(): string | undefined; /** * Formation date (trusts only) * Returns undefined for individuals and companies */ get formationDate(): Date | undefined; /** * Scopes this client belongs to (e.g. ["MX", "MX:AV:AVI"]). */ get scopes(): string[]; /** * Tags applied to this client. */ get tags(): EmbeddedTag[]; /** * Checks if client has data for a specific scope */ hasScope(scope: Scope): boolean; /** * Raw scope data object */ get scopeData(): BaseClient["scopeData"]; /** * External ID for integration with other systems */ get externalId(): string | undefined; /** * Custom metadata */ get metadata(): Record | undefined; /** * Primary email (if included) */ get email(): string | null | undefined; /** * Primary phone (if included) */ get phone(): string | null | undefined; /** * Computed age in whole years, derived from the type-appropriate date * (birthDate for individuals, incorporationDate for companies, * formationDate for trusts). Null when the source date is missing. */ get age(): number | null | undefined; /** * Addresses (if included) */ get addresses(): Address[] | undefined; /** * Contact methods (if included) */ get contactMethods(): ContactMethod[] | undefined; /** * Bank accounts (if included) */ get bankAccounts(): BankAccount[] | undefined; /** * Documents (if included) */ get documents(): Document[] | undefined; /** * Linked clients (if included) */ get linkedClients(): { relationshipType: ClientRelationshipType; client: Client; }[] | undefined; /** * Raw risk assessments map — keyed by assessment name, each value is an * append-only array of snapshots representing the assessment history. */ get riskAssessments(): RiskAssessments; /** * Names of all risk assessments attached to this client. */ get riskAssessmentNames(): string[]; /** * Retrieve a specific risk assessment snapshot by name and optional version. * Version is the 0-based index in the append-only history array. * Defaults to the latest (most recent) version. * * @param name - The assessment name * @param version - Optional 0-based version index (defaults to latest) * @returns The snapshot, or undefined if not found */ riskAssessment(name: string, version?: number): RiskAssessmentSnapshot | undefined; /** * List all available versions for a named risk assessment. * * @param name - The assessment name * @returns Array of `{ version, calculatedAt }` entries, or empty array if not found */ riskAssessmentVersions(name: string): { version: number; calculatedAt: string; }[]; /** * Get the overall score for a risk assessment. * * - With a name: returns the overall score of the latest version of that assessment. * - Without a name: returns the overall score of the most recently calculated * assessment across all assessments (by `calculatedAt`). * * @param name - Optional assessment name * @returns The overall score, or undefined if no assessments exist */ riskAssessmentScore(name?: string): number | undefined; /** * Get the display-ready risk score for the most recent assessment. * Returns the score scaled to maxScore and rounded per the stored mode, * along with the maxScore denominator. * * @returns `{ score, maxScore }` or undefined if no assessments exist */ riskAssessmentDisplayScore(): { score: number; minScore: number; maxScore: number; label?: string; } | undefined; /** Find the most recently calculated snapshot across all assessments */ private _latestRiskSnapshot; /** * When the client was created */ get createdAt(): Date; /** * When the client was last updated */ get updatedAt(): Date; toString(): string; } /** * Check if value is any type of Client model */ export declare function isClient(value: unknown): value is Client; /** * Check if client is an individual (individual) */ export declare function isIndividual(client: Client): boolean; /** * Check if client is a company (legal entity) */ export declare function isCompany(client: Client): boolean; /** * Check if client is a trust */ export declare function isTrust(client: Client): boolean;