"""Describe bulk import method for BulkImports."""

from __future__ import annotations

from typing import Any

import msgspec

from pinecone._internal.validation import require_non_empty
from pinecone.models.bulk_imports.import_model import ImportModel


_DECODER = msgspec.json.Decoder(ImportModel)


def describe(
    self: Any,
    *,
    id: str,
) -> ImportModel:
    """Describe a bulk import operation.

    Args:
        id (str): The import operation ID.

    Returns:
        ImportModel with details about the import operation.

    Raises:
        ValueError: If required parameters are empty.
        PineconeApiException: If the API request fails.

    Examples:
        >>> imp = index.bulk_imports.describe(id="import-123")
        >>> print(f"{imp.status}: {imp.percent_complete}%")
    """
    require_non_empty("id", id)

    data = self._make_data_plane_request("GET", f"/bulk/imports/{id}")
    return _DECODER.decode(data)
