from typing import Annotated

from fastapi import APIRouter, Depends
from psycopg import Connection
from src.__types.index import Tenant
from src.domain.entities.quota import Quota
from src.routers.management.authorizer import get_tenant
from src.routers.management.connection import get_connection
from src.usecases.quota_usecase import QuotaUseCase

router = APIRouter(
    prefix="/quota",
    tags=["クォータ"],
)


@router.get(
    "",
    summary="取得",
    description="クォータを取得します。",
)
def get(
    tenant: Annotated[Tenant, Depends(get_tenant)],
    connection: Annotated[Connection, Depends(get_connection)],
) -> Quota:
    usecase = QuotaUseCase.create(tenant=tenant, connection=connection)
    return usecase.get()
