from uuid import UUID
from fastapi import Request
from shared.exceptions import TenantNotResolvedError
from shared.tenant import STATE_TENANT_ID
from app.core.database import get_db
def require_tenant(request: Request):
    tenant_id=getattr(request.state,STATE_TENANT_ID,None)
    if tenant_id is None: raise TenantNotResolvedError("X-Tenant-ID required")
    return UUID(str(tenant_id))
