// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title IRateAccrual
 * @notice Interface for Rate & Accrual Module
 * @dev Applies time-based interest to outstanding debt
 */
interface IRateAccrual {
    /**
     * @notice Accrue interest for an asset
     * @param asset Asset address
     * @return newAccumulator Updated rate accumulator
     */
    function accrueInterest(address asset) external returns (uint256 newAccumulator);

    /**
     * @notice Get current rate accumulator for an asset
     * @param asset Asset address
     * @return accumulator Current rate accumulator
     */
    function getRateAccumulator(address asset) external view returns (uint256 accumulator);

    /**
     * @notice Set interest rate for an asset
     * @param asset Asset address
     * @param rate Annual interest rate in basis points (e.g., 500 = 5%)
     */
    function setInterestRate(address asset, uint256 rate) external;

    /**
     * @notice Get interest rate for an asset
     * @param asset Asset address
     * @return rate Annual interest rate in basis points
     */
    function interestRate(address asset) external view returns (uint256);

    /**
     * @notice Calculate debt with accrued interest
     * @param asset Asset address
     * @param principal Principal debt amount
     * @return debtWithInterest Debt amount with accrued interest
     */
    function calculateDebtWithInterest(address asset, uint256 principal) external view returns (uint256 debtWithInterest);

    event InterestAccrued(address indexed asset, uint256 oldAccumulator, uint256 newAccumulator);
    event InterestRateSet(address indexed asset, uint256 rate);
}
