from enum import Enum


class AccessType(Enum):
    READ = 1
    WRITE = 2


class WikiMode(Enum):
    OPEN = 1
    PUBLIC = 2
    PRIVATE = 3


def needs_authentication(wiki_mode, access_type):
    """Determine if the access type needs authentication based on the wiki mode"""
    return wiki_mode == WikiMode.PRIVATE \
        or (wiki_mode == WikiMode.PUBLIC and access_type == AccessType.WRITE)


__all__ = ['AccessType', 'WikiMode']
