"""Driver query handlers — Phase 10.1."""
from __future__ import annotations

from uuid import UUID

from sqlalchemy.ext.asyncio import AsyncSession

from app.services.drivers import DriverService
from app.specifications.drivers import DriverListSpec


class DriverQueries:
    def __init__(self, session: AsyncSession) -> None:
        self.service = DriverService(session)

    async def get(self, tenant_id: UUID, driver_id: UUID):
        return await self.service.get(tenant_id, driver_id)

    async def list(
        self,
        tenant_id: UUID,
        *,
        offset: int,
        limit: int,
        spec: DriverListSpec | None,
    ):
        return await self.service.list(
            tenant_id, offset=offset, limit=limit, spec=spec
        )

    async def lifecycle(self, tenant_id: UUID, driver_id: UUID, *, limit: int = 100):
        return await self.service.list_lifecycle(tenant_id, driver_id, limit=limit)

    async def credentials(self, tenant_id: UUID, driver_id: UUID):
        return await self.service.list_credentials(tenant_id, driver_id)

    async def documents(self, tenant_id: UUID, driver_id: UUID):
        return await self.service.list_documents(tenant_id, driver_id)
