"""
Fluent accessor classes for PolicyControlBase resources.

Auto-generated from OpenAPI specification.
"""

from typing import TYPE_CHECKING

from ..models import (
    PolicyControlVersionResponse,
)

if TYPE_CHECKING:
    from ..client import AsyncCredoAI, CredoAI


# =============================================================================
# PolicyControlBase Fluent Accessors (Sync)
# =============================================================================


class PolicyControlBaseVersionsAccessor:
    """Access versions for a specific policy_control_base.

    This accessor provides methods to create, get
    the versions associated with a policy_control_base.

    Example:
        >>> client.policy_control_base("policy_control_base-id").versions.get()
    """

    def __init__(self, client: "CredoAI", policy_control_base_id: str):
        """Initialize the versions accessor.

        Args:
            client: The CredoAI client instance
            policy_control_base_id: The ID of the parent policy_control_base
        """
        self._client = client
        self._policy_control_base_id = policy_control_base_id

    def get(self) -> "PolicyControlVersionResponse":
        """Get the versions for this policy_control_base.

        Returns:
            PolicyControlVersionResponse: The versions data
        """
        return self._client._make_request(
            method="GET",
            url=f"/policy_control_bases/{self._policy_control_base_id}/versions",
            response_model=PolicyControlVersionResponse,
        )


class PolicyControlBase:
    """Fluent accessor for a specific policy_control_base.

    Provides access to related resources through property accessors that enable
    intuitive chaining.

    Example:
        >>> policy_control_base = client.policy_control_base("policy_control_base-id")
        >>> policy_control_base.versions.get()
    """

    def __init__(self, client: "CredoAI", policy_control_base_id: str):
        """Initialize the policy_control_base accessor.

        Args:
            client: The CredoAI client instance
            policy_control_base_id: The ID of the policy_control_base
        """
        self._client = client
        self._policy_control_base_id = policy_control_base_id

    @property
    def versions(self) -> "PolicyControlBaseVersionsAccessor":
        """Access versions associated with this policy_control_base.

        Returns:
            PolicyControlBaseVersionsAccessor: Accessor for versions operations
        """
        return PolicyControlBaseVersionsAccessor(
            self._client, self._policy_control_base_id
        )


# =============================================================================
# PolicyControlBase Fluent Accessors (Async)
# =============================================================================


class AsyncPolicyControlBaseVersionsAccessor:
    """Async access versions for a specific policy_control_base.

    This accessor provides async methods to create, get
    the versions associated with a policy_control_base.

    Example:
        >>> await client.policy_control_base("policy_control_base-id").versions.get()
    """

    def __init__(self, client: "AsyncCredoAI", policy_control_base_id: str):
        """Initialize the async versions accessor.

        Args:
            client: The AsyncCredoAI client instance
            policy_control_base_id: The ID of the parent policy_control_base
        """
        self._client = client
        self._policy_control_base_id = policy_control_base_id

    async def get(self) -> "PolicyControlVersionResponse":
        """Get the versions for this policy_control_base.

        Returns:
            PolicyControlVersionResponse: The versions data
        """
        return await self._client._make_request_async(
            method="GET",
            url=f"/policy_control_bases/{self._policy_control_base_id}/versions",
            response_model=PolicyControlVersionResponse,
        )


class AsyncPolicyControlBase:
    """Async fluent accessor for a specific policy_control_base.

    Provides access to related resources through property accessors that enable
    intuitive chaining with async/await.

    Example:
        >>> policy_control_base = client.policy_control_base("policy_control_base-id")
        >>> await policy_control_base.versions.get()
    """

    def __init__(self, client: "AsyncCredoAI", policy_control_base_id: str):
        """Initialize the async policy_control_base accessor.

        Args:
            client: The AsyncCredoAI client instance
            policy_control_base_id: The ID of the policy_control_base
        """
        self._client = client
        self._policy_control_base_id = policy_control_base_id

    @property
    def versions(self) -> "AsyncPolicyControlBaseVersionsAccessor":
        """Access versions associated with this policy_control_base.

        Returns:
            AsyncPolicyControlBaseVersionsAccessor: Async accessor for versions operations
        """
        return AsyncPolicyControlBaseVersionsAccessor(
            self._client, self._policy_control_base_id
        )


# =============================================================================
# Export list
# =============================================================================

__all__ = [
    "PolicyControlBase",
    "AsyncPolicyControlBase",
    "PolicyControlBaseVersionsAccessor",
    "AsyncPolicyControlBaseVersionsAccessor",
]
