#!/usr/bin/env python3

from contextvars import ContextVar

from attrs import define
from tentacles.db import Db
from werkzeug.local import LocalProxy


@define
class Ctx:
    db: Db
    uid: int = None
    gid: int = None
    sid: str = None
    username: str = None
    is_admin: bool = None
    base_url: str = None


_ctx = ContextVar("tentacles.ctx")
ctx: Ctx = LocalProxy(_ctx)
