24 const std::string&
id()
const override {
return id_; }
25 const std::string&
name()
const override {
return name_; }
37 void reset()
override;
57 std::shared_ptr<const EventType>
event = std::make_shared<EventType>(
SubscriptionId income_sub_
virtual ~AccountBase()=default
const std::string & name() const override
Human-readable name/description.
const std::string & routing_tag() const
Get the routing tag used to match income/expense events.
virtual void on_income(const IncomeEvent &event)
Called when an income event is routed to this account.
SubscriptionId expense_sub_
void reset() override
Reset model to initial state (for replay)
void deposit(SimTime time, double amount, const std::string &reason)
Deposit funds into the account.
const std::string & id() const override
Unique identifier for this model instance.
bool should_handle_event(const std::string &target_account) const
void update(SimTime time) override
void emit(SimTime time, Args &&... args)
double balance() const
Get current balance.
virtual void on_expense(const ExpenseEvent &event)
Called when an expense event is routed to this account.
void withdraw(SimTime time, double amount, const std::string &reason)
Withdraw funds from the account.
const Schedule & schedule() const override
Get the model's execution schedule.
void initialize(EventBus &bus) override
void publish(std::shared_ptr< const EventType > event)
Publish an event to all subscribers.
Event emitted when an expense occurs.
Event emitted when income is received.
double SimTime
Represents a point in simulation time (continuous, in days)
std::size_t SubscriptionId
Subscription handle for unsubscribing.
Schedule make_account_schedule()
Helper to create default schedule for accounts (no periodic updates)