"""Category operations for D365 CSU."""

from __future__ import annotations

from typing import Any

from d365_csu.client import CSUClient


def get_channel_navigation_hierarchy(
    client: CSUClient,
    *,
    top: int = 100,
    skip: int = 0,
) -> Any:
    """Get the channel navigation category hierarchy."""
    body = client.build_query_result_settings(top, skip)
    return client.post("Categories/GetChannelNavigationHierarchy", body)


def get_category(client: CSUClient, category_id: int) -> Any:
    """Get a category by record ID."""
    return client.get(f"Categories({category_id})")
