"""Shared role definitions for backend user management."""

from __future__ import annotations

from enum import Enum
from typing import Final, Set


class UserRole(str, Enum):
    """Enumerated set of supported user roles."""

    ADMIN = "admin"
    MANAGER = "manager"
    MODERATOR = "moderator"
    REVIEWER = "reviewer"
    EDITOR = "editor"
    IMPORTER = "importer"
    VIEWER = "viewer"


ROLE_VALUES: Final[Set[str]] = {role.value for role in UserRole}
ADMIN_ROLE_VALUES: Final[Set[str]] = {
    UserRole.ADMIN.value,
}
DEFAULT_ADMIN_ROLE: Final[str] = UserRole.ADMIN.value
DEFAULT_USER_ROLE: Final[str] = UserRole.VIEWER.value


def is_admin_role(role: str) -> bool:
    """Return True when the provided role is considered an admin role."""
    return role in ADMIN_ROLE_VALUES

