contract AccessControl is Context {
    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
     struct RoleData {
        mapping (address => bool) members;
        bytes32 adminRole;
    }
    
    mapping (bytes32 => RoleData) private _roles;
    
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members[account];
    }
    
    /**
     * setup role
     */ 
    function _setupRole(bytes32 role, address account) internal {
        _grantRole(role, account);
    }

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }
    
    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
    
    
    /**
     * Revoke role
     */
    function _removeRole(bytes32 role, address account) internal {
        _revokeRole(role, account);
    }

     
    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    
    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
    
}
function _setupRole(bytes32 role, address account) internal {
    _grantRole(role, account);
}

/**
 * setup role
 */