from lib.services.rollouts.history_client import HistoryClientInterface
from lib.api_schema.response.flava_services.rollouts.v1_0 import (
    history as schema,
)


class FlavaHistoryClient(HistoryClientInterface):
    """Service client for the Flava Rollout History API.

    This client provides the schema and path to each API endpoint for dependency
    injection.

    NOTE: Paths omit the /v1 prefix because api_version="v1" is set on the
    resource client, and RestClient auto-prepends /{api_version} to the URL.
    """

    def get_schema(self):
        """Provide the response schema of the History API."""
        return schema

    def get_history_path(self, project, product, name):
        """Provide the API endpoint path for rollout history."""
        return f"/projects/{project}/products/{product}/rollouts/{name}/history"

    def get_history_execution_path(self, project, product, name, execution_id):
        """Provide the API endpoint path for a specific history execution."""
        return f"/projects/{project}/products/{product}/rollouts/{name}/history/{execution_id}"
