"""Authentication domain — users, roles, and API keys."""

from repo_core.domains.authentication.model import ApiKey, AuthUser, AuthRole
from repo_core.domains.authentication.schema import (
    ApiKeyCreateRequest,
    ApiKeyResponse,
    ApiKeyCreatedResponse,
    ApiKeyRevokeRequest,
    RegisterRequest,
    LoginRequest,
    UserResponse,
    ApiKeyLoginRequest,
    TokenResponse,
    ApiKeyValidationResult,
    JwtValidationResult,
    RoleResponse,
)
from repo_core.domains.authentication.repository import (
    ApiKeyRepository,
    UserRepository,
    RoleRepository,
    AuthenticationRepository,
    generate_api_key,
    hash_password,
    verify_password,
)

__all__ = [
    "ApiKey",
    "AuthUser",
    "AuthRole",
    "ApiKeyCreateRequest",
    "ApiKeyResponse",
    "ApiKeyCreatedResponse",
    "ApiKeyRevokeRequest",
    "RegisterRequest",
    "LoginRequest",
    "UserResponse",
    "ApiKeyLoginRequest",
    "TokenResponse",
    "ApiKeyValidationResult",
    "JwtValidationResult",
    "RoleResponse",
    "ApiKeyRepository",
    "UserRepository",
    "RoleRepository",
    "AuthenticationRepository",
    "generate_api_key",
    "hash_password",
    "verify_password",
]


def create_api_key_repository() -> ApiKeyRepository:
    """Create an ApiKeyRepository auto-wired from environment variables."""
    return ApiKeyRepository(model=ApiKey)


def create_user_repository() -> UserRepository:
    """Create a UserRepository auto-wired from environment variables."""
    return UserRepository(model=AuthUser)


def create_role_repository() -> RoleRepository:
    """Create a RoleRepository auto-wired from environment variables."""
    return RoleRepository(model=AuthRole)
