from __future__ import annotations as _annotations

from typing import Any

from typing_extensions import deprecated

from pydantic_ai._warnings import PydanticAIDeprecationWarning
from pydantic_ai.profiles import ModelProfile
from pydantic_ai.providers import Provider


@deprecated(
    '`OutlinesProvider` is deprecated and will be removed in v2. '
    'If you would like to keep using Outlines with Pydantic AI, please file an issue at '
    'https://github.com/dottxt-ai/outlines/issues.',
    category=PydanticAIDeprecationWarning,
)
class OutlinesProvider(Provider[Any]):
    """Provider for Outlines API."""

    @property
    def name(self) -> str:
        """The provider name."""
        return 'outlines'

    @property
    def base_url(self) -> str:
        """The base URL for the provider API."""
        raise NotImplementedError(
            'The Outlines provider does not have a set base URL as it functions '
            + 'with a set of different underlying models.'
        )

    @property
    def client(self) -> Any:
        """The client for the provider."""
        raise NotImplementedError(
            'The Outlines provider does not have a set client as it functions '
            + 'with a set of different underlying models.'
        )

    @staticmethod
    def model_profile(model_name: str) -> ModelProfile | None:
        """The model profile for the named model, if available."""
        return ModelProfile(
            supports_tools=False,
            supports_json_schema_output=True,
            supports_json_object_output=True,
            default_structured_output_mode='native',
            native_output_requires_schema_in_instructions=True,
            supports_inline_system_prompts=True,
        )
