/** * Document model * * Represents a file uploaded for a client. * Supports scope-specific document types (MX, US). */ import { DocumentCategory, type DocumentResponse, DocumentStatus } from "@artu-ai/shared"; import { BaseModel } from "./base"; /** * Document data as returned by the API. * Uses the centralized type from @artu-ai/shared. */ export type DocumentData = DocumentResponse; /** * Document model - represents an uploaded file. * * @example * ```typescript * const doc = await sdk.documents.retrieve("doc_123"); * * console.log(doc.filename); // "passport.pdf" * console.log(doc.formattedSize); // "2.5 MB" * console.log(doc.isAvailable); // true * * if (doc.isMexico) { * console.log(doc.type); // "ine_front" | "rfc" | etc. * } * ``` */ export declare class Document extends BaseModel { /** * Unique identifier for the document */ get id(): string; /** * ID of the client this document belongs to */ get clientId(): string; /** * Scope for this document (MX, US) */ get scope(): "MX" | "US"; /** * Document type (scope-specific) */ get type(): string; /** * Document category (identity, address, financial, etc.) */ get category(): DocumentCategory; /** * Document status */ get status(): DocumentStatus; /** * Whether a file is attached to this document */ get hasFile(): boolean; /** * Original filename (undefined if no file attached) */ get filename(): string | undefined; /** * MIME content type (undefined if no file attached) */ get contentType(): string | undefined; /** * File size in bytes (undefined if no file attached) */ get size(): number | undefined; /** * Human-readable file size (e.g., "2.5 MB") * Returns undefined if no file attached */ get formattedSize(): string | undefined; /** * File extension derived from filename * Returns empty string if no file or no extension */ get extension(): string; /** * Whether the document is ready for download */ get isAvailable(): boolean; /** * Whether the document is pending upload */ get isPending(): boolean; /** * Whether the document has been verified */ get isVerified(): boolean; /** * Whether the document was rejected */ get isRejected(): boolean; /** * Whether the document has expired */ get isExpired(): boolean; /** * Document expiration date, if set */ get expiresAt(): Date | undefined; /** * Days until document expires (negative if already expired) */ get daysUntilExpiry(): number | undefined; /** * Reason a document was rejected, if any. Set by `documents.reject(...)`. */ get rejectionReason(): string | undefined; /** * Timestamp when the document was reviewed (verified or rejected). */ get reviewedAt(): Date | undefined; /** * Opaque ID of the user who reviewed the document. */ get reviewedBy(): string | undefined; /** * Timestamp when the document was verified. Retained for back-compat * — prefer `reviewedAt` for new code (verify dual-writes both). */ get verifiedAt(): Date | undefined; /** * Opaque ID of the user who verified the document. See `reviewedBy` * for the canonical field. */ get verifiedBy(): string | undefined; /** * Document-specific fields (extracted or provided data) * * For typed fields, use scope-specific document models: * - MexIneFrontDocument.ineFields * - MexPassportDocument.passportFields * - etc. */ get fields(): Record | undefined; /** * Get a specific field value */ getField(key: string): T | undefined; /** * External ID */ get externalId(): string | undefined; /** * Custom metadata attached to the document */ get metadata(): Record | undefined; /** * Get a specific metadata value */ getMetadata(key: string): T | undefined; /** * When the document was created */ get createdAt(): Date; /** * When the document was last updated */ get updatedAt(): Date; /** * Whether this is a Mexico document */ get isMexico(): boolean; /** * Whether this is an identity document */ get isIdentityDocument(): boolean; /** * Whether this is an address proof document */ get isAddressProof(): boolean; /** * Whether this is a financial document */ get isFinancialDocument(): boolean; /** * Whether this is an incorporation document */ get isIncorporationDocument(): boolean; /** * Whether this is a tax document */ get isTaxDocument(): boolean; }