"""CLI-artifact usage-accounting adapter."""
from __future__ import annotations

from okstra_ctl.ports.usage_accounting import UsageRequest, UsageSnapshot
from okstra_token_usage.collect import (
    collect_cli_runtime_usage as collect_runtime_usage,
)


class CliArtifactUsageAccountingPort:
    def collect(self, request: UsageRequest) -> UsageSnapshot:
        payload = collect_runtime_usage(
            request.team_state_path,
            request.project_root,
            incremental=request.incremental,
        )
        return UsageSnapshot(source="cli-artifact", payload=payload)
