import * as plugins from './plugins.js'; import type { TSKRType, IJournalEntry, IJournalEntryLine } from './skr.types.js'; export declare const JOURNAL_ENTRY_COLLECTION = "JournalEntry"; /** * The partial unique index over the hash chain's sequence numbers. SmartData * models cannot declare a partial index, so the storage migration * (ts_migration/) owns it and the model tolerates it. */ export declare const JOURNAL_SEQUENCE_INDEX_NAME = "skrType_1_fiscalYear_1_sequenceNumber_1"; /** * The partial unique index over `legacyTransactionId`: each legacy Transaction * is imported into the journal at most once. The ledger migration * (ts_migration/) owns it and the model tolerates it. */ export declare const JOURNAL_LEGACY_TRANSACTION_INDEX_NAME = "legacyTransactionId_1"; export declare class JournalEntry extends plugins.nosqldb.SmartDataDbDoc { id: string; journalNumber: string; date: Date; description: string; reference: string; /** the element fields the balance aggregation groups and sums by */ lines: IJournalEntryLine[]; skrType: TSKRType; totalDebits: number; totalCredits: number; isBalanced: boolean; status: 'draft' | 'posted' | 'reversed' | 'finalized'; schemaVersion?: number; sequenceNumber?: number; prevHash?: string; entryHash?: string; finalizedAt?: Date | null; reversalOf?: string; taxScenario?: string; currency?: string; transactionIds: string[]; period: string; fiscalYear: number; createdAt: Date; postedAt: Date | null; createdBy: string; constructor(data?: Partial); private generateJournalNumber; private sanitizeLines; private calculateTotals; /** * Retired: persisted an unposted draft. Drafts live in memory * (`core.IJournalDraft`); only hashed postings are stored. */ static createJournalEntry(_data: IJournalEntry): Promise; addLine(line: IJournalEntryLine): void; removeLine(index: number): void; validate(): Promise; /** * Retired: posted this instance in place and wrote a Transaction per * debit/credit pair. A posting is a new hashed entry with its own sequence * number, so an existing instance cannot become one. */ post(): Promise; /** * Retired: marked the original 'reversed'. A posted entry is immutable; * a Storno entry reverses it. */ reverse(): Promise; beforeSave(): Promise; delete(opts?: Parameters['delete']>[0]): Promise; }