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

/**
 * @title ITokenRegistry
 * @notice Interface for ISO-4217 W token registry
 * @dev Canonical registry mapping ISO-4217 codes to token addresses
 */
interface ITokenRegistry {
    struct TokenInfo {
        address tokenAddress;
        string currencyCode;        // ISO-4217 code (e.g., "USD")
        string tokenSymbol;         // Token symbol (e.g., "USDW")
        uint8 decimals;
        address custodian;
        address mintController;
        address burnController;
        bool isActive;
        uint256 createdAt;
    }

    /**
     * @notice Register a new ISO-4217 W token
     * @param currencyCode ISO-4217 currency code (must be valid ISO-4217)
     * @param tokenAddress Token contract address
     * @param tokenSymbol Token symbol (should be <CCC>W format)
     * @param decimals Token decimals (typically 2 for fiat currencies)
     * @param custodian Custodian address
     */
    function registerToken(
        string memory currencyCode,
        address tokenAddress,
        string memory tokenSymbol,
        uint8 decimals,
        address custodian
    ) external;

    /**
     * @notice Get token address for ISO-4217 code
     * @param currencyCode ISO-4217 currency code
     * @return tokenAddress Token contract address
     */
    function getTokenAddress(string memory currencyCode) external view returns (address tokenAddress);

    /**
     * @notice Get token info for ISO-4217 code
     * @param currencyCode ISO-4217 currency code
     * @return info Token information
     */
    function getTokenInfo(string memory currencyCode) external view returns (TokenInfo memory info);

    /**
     * @notice Check if currency code is registered
     * @param currencyCode ISO-4217 currency code
     * @return registered True if registered
     */
    function isRegistered(string memory currencyCode) external view returns (bool registered);

    /**
     * @notice Deactivate a token (emergency)
     * @param currencyCode ISO-4217 currency code
     */
    function deactivateToken(string memory currencyCode) external;

    /**
     * @notice Set mint controller for a token
     * @param currencyCode ISO-4217 currency code
     * @param mintController Mint controller address
     */
    function setMintController(string memory currencyCode, address mintController) external;

    /**
     * @notice Set burn controller for a token
     * @param currencyCode ISO-4217 currency code
     * @param burnController Burn controller address
     */
    function setBurnController(string memory currencyCode, address burnController) external;

    event TokenRegistered(
        string indexed currencyCode,
        address indexed tokenAddress,
        string tokenSymbol,
        address indexed custodian
    );
    event TokenDeactivated(string indexed currencyCode, uint256 timestamp);
}
