"""Usage analytics — spend by cost center, owner, and model."""

from __future__ import annotations

from typing import Any, Optional

from .._resource import AsyncResource, Resource


class Usage(Resource):
    """Usage analytics: summary, cost center, and owner breakdowns."""

    def summary(self, period: str = "month") -> Any:
        """Get usage summary for the given period."""
        return self._get("/v1/usage/summary", {"period": period})

    def by_cost_center(self, period: str = "month") -> Any:
        """Get aggregated spend by cost center."""
        return self._get("/v1/usage/by-cost-center", {"period": period})

    def by_owner(self, period: str = "month") -> Any:
        """Get aggregated spend by agent owner."""
        return self._get("/v1/usage/by-owner", {"period": period})


class AsyncUsage(AsyncResource):
    """Async usage analytics: summary, cost center, and owner breakdowns."""

    async def summary(self, period: str = "month") -> Any:
        return await self._get("/v1/usage/summary", {"period": period})

    async def by_cost_center(self, period: str = "month") -> Any:
        return await self._get("/v1/usage/by-cost-center", {"period": period})

    async def by_owner(self, period: str = "month") -> Any:
        return await self._get("/v1/usage/by-owner", {"period": period})
