"""Analytics boundary validation — Phase 11.10."""
from typing import Any

from app.validators.foundation import ValidationError
from app.validators.integrations import validate_json_object


def validate_metadata(value: Any) -> dict | None:
    return validate_json_object(value, "metadata_json")


def validate_metric_keys(metric_keys: list[str]) -> list[str]:
    if not metric_keys:
        raise ValidationError(
            "حداقل یک metric_key الزامی است",
            {"field": "metric_keys"},
        )
    if not isinstance(metric_keys, list):
        raise ValidationError("metric_keys باید آرایه باشد", {"field": "metric_keys"})
    return metric_keys
