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

import "../interfaces/IAssetTypeHandler.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/**
 * @title ERC20Handler
 * @notice Handler for standard ERC-20 tokens
 */
contract ERC20Handler is IAssetTypeHandler {
    function validateAsset(address token) external view override returns (bool) {
        if (token.code.length == 0) return false;
        
        try IERC20(token).totalSupply() returns (uint256) {
            return true;
        } catch {
            return false;
        }
    }

    function getRequiredCompliance() external pure override returns (UniversalAssetRegistry.ComplianceLevel) {
        return UniversalAssetRegistry.ComplianceLevel.Public;
    }

    function getDefaultLimits() external pure override returns (uint256 min, uint256 max) {
        return (1e15, 1000000e18); // 0.001 to 1M tokens
    }

    function preTransferHook(address, address, uint256) external pure override {
        // No pre-transfer checks for standard ERC-20
    }

    function postTransferHook(address, address, uint256) external pure override {
        // No post-transfer hooks for standard ERC-20
    }
}
