"""Async sub-namespace for bulk import operations on a Pinecone index."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any


if TYPE_CHECKING:
    from pinecone.async_bulk_imports import _cancel, _describe, _helpers, _list, _start
    from pinecone.models.bulk_imports.cancel import CancelImportResponse
    from pinecone.models.bulk_imports.import_model import ImportModel
    from pinecone.models.bulk_imports.list import ListImportsResponse
    from pinecone.models.bulk_imports.start import StartImportResponse


class AsyncBulkImports:
    """Async sub-namespace for bulk import operations on a Pinecone index.

    Access via the ``bulk_imports`` property on an AsyncIndex instance::

        async with AsyncIndex(host="...", api_key="...") as index:
            imports = await index.bulk_imports.list()

    Args:
        http: Async HTTP client for making requests.
        base_url: Base URL for the index data plane.
    """

    def __init__(self, *, http: Any, base_url: str) -> None:
        self._http = http
        self._base_url = base_url

        from pinecone.async_bulk_imports import (
            _cancel,
            _describe,
            _helpers,
            _list,
            _start,
        )

        self._make_data_plane_request = _helpers._make_data_plane_request.__get__(self, type(self))
        self.start = _start.start.__get__(self, type(self))  # type: ignore[method-assign]
        self.list = _list.list.__get__(self, type(self))  # type: ignore[method-assign]
        self.describe = _describe.describe.__get__(self, type(self))  # type: ignore[method-assign]
        self.cancel = _cancel.cancel.__get__(self, type(self))  # type: ignore[method-assign]

    # Protocol method stubs (overridden in __init__)
    async def start(  # type: ignore[no-untyped-def]
        self, *args, **kwargs
    ) -> StartImportResponse:
        """Stub for start method (overridden in __init__)."""
        raise NotImplementedError  # pragma: no cover

    async def list(  # type: ignore[no-untyped-def]
        self, *args, **kwargs
    ) -> ListImportsResponse:
        """Stub for list method (overridden in __init__)."""
        raise NotImplementedError  # pragma: no cover

    async def describe(  # type: ignore[no-untyped-def]
        self, *args, **kwargs
    ) -> ImportModel:
        """Stub for describe method (overridden in __init__)."""
        raise NotImplementedError  # pragma: no cover

    async def cancel(  # type: ignore[no-untyped-def]
        self, *args, **kwargs
    ) -> CancelImportResponse:
        """Stub for cancel method (overridden in __init__)."""
        raise NotImplementedError  # pragma: no cover

    def __repr__(self) -> str:
        """Return string representation."""
        return f"AsyncBulkImports(base_url={self._base_url!r})"
