contract GlobalWhitelist is Ownable, Manageable {
    mapping(address => bool) public isWhitelisted; // addresses of who's whitelisted
    bool public isWhitelisting = true;             // whitelisting enabled by default

    /** EVENTS **/
    event ChangedWhitelisting(address indexed registrant, bool whitelisted);
    event GlobalWhitelistDisabled(address indexed manager);
    event GlobalWhitelistEnabled(address indexed manager);

    /**
    * @dev add an address to the whitelist
    * @param _address address
    */
    function addAddressToWhitelist(address _address) public onlyManager onlyValidAddress(_address) {
        isWhitelisted[_address] = true;
        emit ChangedWhitelisting(_address, true);
    }

    /**
    * @dev add addresses to the whitelist
    * @param _addresses addresses array
    */
    function addAddressesToWhitelist(address[] calldata _addresses) external {
        for (uint256 i = 0; i < _addresses.length; i++) {
            addAddressToWhitelist(_addresses[i]);
        }
    }

    /**
    * @dev remove an address from the whitelist
    * @param _address address
    */
    function removeAddressFromWhitelist(address _address) public onlyManager onlyValidAddress(_address) {
        isWhitelisted[_address] = false;
        emit ChangedWhitelisting(_address, false);
    }

    /**
    * @dev remove addresses from the whitelist
    * @param _addresses addresses
    */
    function removeAddressesFromWhitelist(address[] calldata _addresses) external {
        for (uint256 i = 0; i < _addresses.length; i++) {
            removeAddressFromWhitelist(_addresses[i]);
        }
    }

    /** 
    * @notice toggle the whitelist by the parent contract; ExporoTokenFactory
    */
    function toggleWhitelist() external onlyOwner {
        isWhitelisting = isWhitelisting ? false : true;

        if (isWhitelisting) {
            emit GlobalWhitelistEnabled(msg.sender);
        } else {
            emit GlobalWhitelistDisabled(msg.sender);
        }
    }
}
function addAddressToWhitelist(address _address) public onlyManager onlyValidAddress(_address) {
    isWhitelisted[_address] = true;
    emit ChangedWhitelisting(_address, true);
}

/**
 * @dev add an address to the whitelist
 * @param _address address
 */