from typing import Optional

from spotlight.api.data.model import TimeseriesQueryRequest, DistinctQueryRequest


def _query_timeseries_request_info(request: TimeseriesQueryRequest) -> dict:
    return {"endpoint": f"data/v1.1/timeseries", "json": request.request_dict()}


def _query_dataset_csv_request_info(id: str, request: TimeseriesQueryRequest) -> dict:
    return {"endpoint": f"data/v1.1/{id}.csv", "json": request.request_dict()}


def _query_distinct_fields_request_info(
    request: DistinctQueryRequest, use_cache: Optional[bool] = None
) -> dict:
    return {
        "endpoint": f"data/v1.1/distinct",
        "json": request.request_dict(),
        "params": {"cache": str(use_cache)},
    }


def _sdr_health_request_info() -> dict:
    return {"endpoint": f"data/v1.1/sdr/health"}
