**tktax-check** is a Rust crate within the TKTAX ecosystem, providing a mechanism to classify and retrieve **Check** or **Treasury** transactions from a financial **Account**. Drawing upon underlying modules (tktax\_3p, tktax\_account, tktax\_line\_item, tktax\_money, tktax\_transaction, tktax\_transaction\_category), it encapsulates domain-specific transaction logic to facilitate reporting, analysis, and high-level accounting workflows.
### Overview
- **Core Structure**
The `CheckOrTreasuryTransaction<'a, TxCat>` struct (where `TxCat: TransactionCategory + 'static`) provides a specialized aggregator for a transaction (from _transactio_ in Latin) and its category (from Κατηγορία in Ancient Greek).
- Implements the `LineItem<TxCat>` trait for uniformity with other items in the TKTAX pipeline.
- Exposes `tx_amount()`, `category()`, and `tx()` to integrate seamlessly with higher-level logic.
- **Category Prediction**
Uses a `CategoryMap<TxCat>` to predict categories from transaction descriptions. If a transaction belongs to a recognized "treasury/check" category, it is collected into a type-safe vector for further accounting or auditing procedures.
- **Example Usage**
```rust
use tktax_check::GetTreasuryTransactionsAndChecks;
fn process_account(account: &Account, category_map: &CategoryMap<YourTxCat>) {
let treasury_and_checks = account.treasury_transactions_and_checks(category_map);
for item in treasury_and_checks {
println!("{}", item);
}
}
```
This function retrieves and prints all relevant **Check** or **Treasury** transactions from the given `Account`.
### Features
- **Idempotent Classification**
Repeated calls on the same data set yield consistent results without data mutation side effects.
- **Sorting by Category**
Retrieved transactions are automatically sorted by their respective category. This sorting allows you to programmatically group checks and treasury transactions in ascending category order.
- **Minimal Coupling**
The crate is designed to be orthogonally integrated with the existing TKTAX modules while retaining an isolated core logic.
### Getting Started
Add the following to your `Cargo.toml`:
```toml
[dependencies]
tktax-check = "0.1.0"
```
Ensure your project also includes dependencies for the underlying TKTAX modules (e.g., `tktax_3p`, `tktax_account`, etc.) as needed.
### Contributing
Contributions to **tktax-check** are welcome. Please open issues or merge requests on the repository to propose changes. For complex new features or refactors, discussion is appreciated before submission to maintain design coherence.