contract AuthorizeableUpgradeable is
    Initializable,
    ContextUpgradeable,
    OwnableUpgradeable
{
    address[] private _authorizedAddresses;

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Authorizeable_init() internal initializer {
        __Context_init_unchained();
    }

    function addAuthorizedAddress(address address_) external onlyOwner {
        require(address_ != address(0), "Add authorize address is zero");
        for (uint256 i = 0; i < _authorizedAddresses.length; i++) {
            require(
                _authorizedAddresses[i] != address_,
                "address_ already exists"
            );
        }
        _authorizedAddresses.push(address_);
    }

    function removeAuthorizedAddress(address address_) external onlyOwner {
        require(address_ != address(0), "Remove authorize address is zero");
        for (uint256 i = 0; i < _authorizedAddresses.length; i++) {
            if (_authorizedAddresses[i] == address_) {
                _authorizedAddresses[i] = _authorizedAddresses[
                    _authorizedAddresses.length - 1
                ];
                _authorizedAddresses.pop();
                return;
            }
        }
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function authorizedAddresses()
        external
        view
        onlyOwner
        returns (address[] memory)
    {
        return _authorizedAddresses;
    }

    modifier onlyAuthorized() {
        address msgSender = _msgSender();
        bool isAuthorized = false;

        for (uint256 i = 0; i < _authorizedAddresses.length; i++) {
            if (_authorizedAddresses[i] == msgSender) {
                isAuthorized = true;
                break;
            }
        }

        require(isAuthorized, "Sender not authorized");

        _;
    }
}
function __Authorizeable_init() internal initializer {
    __Context_init_unchained();
}

/**
 * @dev Initializes the contract setting the deployer as the initial owner.
 */