"""Shared aiohttp AppKey definitions for gateway app state."""

from __future__ import annotations

from typing import Callable, Optional

from aiohttp import web

from .middleware.auth import AuthBackend
from .pricing import OrgPlanCache
from .settings import GatewaySettings
from .stores import BillingStore

SETTINGS_KEY: web.AppKey[GatewaySettings] = web.AppKey("gateway_settings")
BILLING_STORE_KEY: web.AppKey[BillingStore] = web.AppKey("gateway_billing_store")
PLAN_CACHE_KEY: web.AppKey[OrgPlanCache] = web.AppKey("gateway_plan_cache")
REQUIRE_ADMIN_KEY: web.AppKey[Callable[[web.Request], None]] = web.AppKey("gateway_require_admin")
PG_POOL_KEY: web.AppKey[Optional[object]] = web.AppKey("gateway_pg_pool")
AUTH_BACKEND_KEY: web.AppKey[AuthBackend] = web.AppKey("gateway_auth_backend")


__all__ = [
    "AUTH_BACKEND_KEY",
    "SETTINGS_KEY",
    "BILLING_STORE_KEY",
    "PLAN_CACHE_KEY",
    "REQUIRE_ADMIN_KEY",
    "PG_POOL_KEY",
]
