# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Literal

import httpx

from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
    to_raw_response_wrapper,
    to_streamed_response_wrapper,
    async_to_raw_response_wrapper,
    async_to_streamed_response_wrapper,
)
from ...types.views import v2_list_hero_views_params, v2_retrieve_hero_filter_params
from ..._base_client import make_request_options
from ...types.views.v2_list_hero_views_response import V2ListHeroViewsResponse
from ...types.views.v2_retrieve_hero_filter_response import V2RetrieveHeroFilterResponse

__all__ = ["V2Resource", "AsyncV2Resource"]


class V2Resource(SyncAPIResource):
    @cached_property
    def with_raw_response(self) -> V2ResourceWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/alisytsma/ali-test-mcp#accessing-raw-response-data-eg-headers
        """
        return V2ResourceWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> V2ResourceWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/alisytsma/ali-test-mcp#with_streaming_response
        """
        return V2ResourceWithStreamingResponse(self)

    def list_hero_views(
        self,
        *,
        id: str | NotGiven = NOT_GIVEN,
        _type: Literal["HeroShowView", "HeroShowGroupView"] | NotGiven = NOT_GIVEN,
        exclude: Literal["WEB_ONLY", "MOBILE_ONLY"] | NotGiven = NOT_GIVEN,
        fieldset: Literal["HeroEssentials", "HeroSuperEssentials"] | NotGiven = NOT_GIVEN,
        filter: Literal["CITY_LANDING_TOP"] | NotGiven = NOT_GIVEN,
        limit: int | NotGiven = NOT_GIVEN,
        location: int | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> V2ListHeroViewsResponse:
        """
        Get list of hero views for specific location, or for a list of Shows or
        ShowGroups

        When `location` is passed:

        - Ignore `showId` and `showGroupId`
        - Return a list of hero views for the specific location.

        When `location` is NOT passed:

        - Return a list of hero views for the `Show`s or `ShowGroup`s specified by the
          ids in the list.

        Supports pagination.

        Args:
          id: Comma-separated ids for the requested resources. If \\__type is HeroShowView, this
              is a list of id for Shows. If \\__type is HeroShowGroupView, this is a list of id
              for ShowGroups.

          exclude: Allows us to exclude heroes that should only be displayed on web or mobile.
              WARNING: The cachestroker does not warm these query params. If you need to use
              these params we should update the cachestroker.

          fieldset: A way to limit the response to only the fields needed for rendering the heroes
              themselves, and not other show/show group fields. If HeroEssentials: the
              endpoint will return ShowHeroEssentials and ShowGroupHeroEssentials objects
              inside the show or showGroup fields within each HeroView. If
              HeroSuperEssentials: include a summary of showtime data instead of the list of
              actual showtime maps for HeroShowView. Include a summary of whether a showGroup
              has rush or lottery active.

          filter: Generic options for filtering TodayTix API resources. Note that these filter
              types are intended to provide consistency at the conceptual / product level, but
              may vary in implementation between resources.

          limit: Max number of results to be returned, if specified.

          location: location Id

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._get(
            "/views/v2/heroList",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform(
                    {
                        "id": id,
                        "_type": _type,
                        "exclude": exclude,
                        "fieldset": fieldset,
                        "filter": filter,
                        "limit": limit,
                        "location": location,
                    },
                    v2_list_hero_views_params.V2ListHeroViewsParams,
                ),
            ),
            cast_to=V2ListHeroViewsResponse,
        )

    def retrieve_hero_filter(
        self,
        *,
        location: int,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> V2RetrieveHeroFilterResponse:
        """
        Get Hero Filter to fulfill filter view

        Args:
          location: location Id

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._get(
            "/views/v2/heroFilter",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform(
                    {"location": location}, v2_retrieve_hero_filter_params.V2RetrieveHeroFilterParams
                ),
            ),
            cast_to=V2RetrieveHeroFilterResponse,
        )


class AsyncV2Resource(AsyncAPIResource):
    @cached_property
    def with_raw_response(self) -> AsyncV2ResourceWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/alisytsma/ali-test-mcp#accessing-raw-response-data-eg-headers
        """
        return AsyncV2ResourceWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> AsyncV2ResourceWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/alisytsma/ali-test-mcp#with_streaming_response
        """
        return AsyncV2ResourceWithStreamingResponse(self)

    async def list_hero_views(
        self,
        *,
        id: str | NotGiven = NOT_GIVEN,
        _type: Literal["HeroShowView", "HeroShowGroupView"] | NotGiven = NOT_GIVEN,
        exclude: Literal["WEB_ONLY", "MOBILE_ONLY"] | NotGiven = NOT_GIVEN,
        fieldset: Literal["HeroEssentials", "HeroSuperEssentials"] | NotGiven = NOT_GIVEN,
        filter: Literal["CITY_LANDING_TOP"] | NotGiven = NOT_GIVEN,
        limit: int | NotGiven = NOT_GIVEN,
        location: int | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> V2ListHeroViewsResponse:
        """
        Get list of hero views for specific location, or for a list of Shows or
        ShowGroups

        When `location` is passed:

        - Ignore `showId` and `showGroupId`
        - Return a list of hero views for the specific location.

        When `location` is NOT passed:

        - Return a list of hero views for the `Show`s or `ShowGroup`s specified by the
          ids in the list.

        Supports pagination.

        Args:
          id: Comma-separated ids for the requested resources. If \\__type is HeroShowView, this
              is a list of id for Shows. If \\__type is HeroShowGroupView, this is a list of id
              for ShowGroups.

          exclude: Allows us to exclude heroes that should only be displayed on web or mobile.
              WARNING: The cachestroker does not warm these query params. If you need to use
              these params we should update the cachestroker.

          fieldset: A way to limit the response to only the fields needed for rendering the heroes
              themselves, and not other show/show group fields. If HeroEssentials: the
              endpoint will return ShowHeroEssentials and ShowGroupHeroEssentials objects
              inside the show or showGroup fields within each HeroView. If
              HeroSuperEssentials: include a summary of showtime data instead of the list of
              actual showtime maps for HeroShowView. Include a summary of whether a showGroup
              has rush or lottery active.

          filter: Generic options for filtering TodayTix API resources. Note that these filter
              types are intended to provide consistency at the conceptual / product level, but
              may vary in implementation between resources.

          limit: Max number of results to be returned, if specified.

          location: location Id

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._get(
            "/views/v2/heroList",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=await async_maybe_transform(
                    {
                        "id": id,
                        "_type": _type,
                        "exclude": exclude,
                        "fieldset": fieldset,
                        "filter": filter,
                        "limit": limit,
                        "location": location,
                    },
                    v2_list_hero_views_params.V2ListHeroViewsParams,
                ),
            ),
            cast_to=V2ListHeroViewsResponse,
        )

    async def retrieve_hero_filter(
        self,
        *,
        location: int,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> V2RetrieveHeroFilterResponse:
        """
        Get Hero Filter to fulfill filter view

        Args:
          location: location Id

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._get(
            "/views/v2/heroFilter",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=await async_maybe_transform(
                    {"location": location}, v2_retrieve_hero_filter_params.V2RetrieveHeroFilterParams
                ),
            ),
            cast_to=V2RetrieveHeroFilterResponse,
        )


class V2ResourceWithRawResponse:
    def __init__(self, v2: V2Resource) -> None:
        self._v2 = v2

        self.list_hero_views = to_raw_response_wrapper(
            v2.list_hero_views,
        )
        self.retrieve_hero_filter = to_raw_response_wrapper(
            v2.retrieve_hero_filter,
        )


class AsyncV2ResourceWithRawResponse:
    def __init__(self, v2: AsyncV2Resource) -> None:
        self._v2 = v2

        self.list_hero_views = async_to_raw_response_wrapper(
            v2.list_hero_views,
        )
        self.retrieve_hero_filter = async_to_raw_response_wrapper(
            v2.retrieve_hero_filter,
        )


class V2ResourceWithStreamingResponse:
    def __init__(self, v2: V2Resource) -> None:
        self._v2 = v2

        self.list_hero_views = to_streamed_response_wrapper(
            v2.list_hero_views,
        )
        self.retrieve_hero_filter = to_streamed_response_wrapper(
            v2.retrieve_hero_filter,
        )


class AsyncV2ResourceWithStreamingResponse:
    def __init__(self, v2: AsyncV2Resource) -> None:
        self._v2 = v2

        self.list_hero_views = async_to_streamed_response_wrapper(
            v2.list_hero_views,
        )
        self.retrieve_hero_filter = async_to_streamed_response_wrapper(
            v2.retrieve_hero_filter,
        )
