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

from __future__ import annotations

import os
from typing import Any, cast

import pytest

from ali_test_2 import AliTest2, AsyncAliTest2
from tests.utils import assert_matches_type
from ali_test_2._utils import parse_date
from ali_test_2.types.api.v2.shows import (
    ShowtimeListResponse,
    ShowtimeRetrieveSectionsResponse,
    ShowtimeRetrieveInventoryItemsResponse,
    ShowtimeRetrieveWithRushAvailabilityResponse,
)

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")


class TestShowtimes:
    parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])

    @pytest.mark.skip()
    @parametrize
    def test_method_list(self, client: AliTest2) -> None:
        showtime = client.api.v2.shows.showtimes.list(
            show_id=0,
        )
        assert_matches_type(ShowtimeListResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_method_list_with_all_params(self, client: AliTest2) -> None:
        showtime = client.api.v2.shows.showtimes.list(
            show_id=0,
            end_date=parse_date("2019-12-27"),
            include_no_inventory="includeNoInventory",
            max_price=0,
            min_price=0,
            quantity=0,
            start_date=parse_date("2019-12-27"),
            ticket_type="ticketType",
            use_override_fields=True,
        )
        assert_matches_type(ShowtimeListResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_list(self, client: AliTest2) -> None:
        response = client.api.v2.shows.showtimes.with_raw_response.list(
            show_id=0,
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        showtime = response.parse()
        assert_matches_type(ShowtimeListResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_list(self, client: AliTest2) -> None:
        with client.api.v2.shows.showtimes.with_streaming_response.list(
            show_id=0,
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            showtime = response.parse()
            assert_matches_type(ShowtimeListResponse, showtime, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    def test_method_retrieve_inventory_items(self, client: AliTest2) -> None:
        showtime = client.api.v2.shows.showtimes.retrieve_inventory_items(
            showtime_id=0,
            show_id=0,
        )
        assert_matches_type(ShowtimeRetrieveInventoryItemsResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_retrieve_inventory_items(self, client: AliTest2) -> None:
        response = client.api.v2.shows.showtimes.with_raw_response.retrieve_inventory_items(
            showtime_id=0,
            show_id=0,
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        showtime = response.parse()
        assert_matches_type(ShowtimeRetrieveInventoryItemsResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_retrieve_inventory_items(self, client: AliTest2) -> None:
        with client.api.v2.shows.showtimes.with_streaming_response.retrieve_inventory_items(
            showtime_id=0,
            show_id=0,
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            showtime = response.parse()
            assert_matches_type(ShowtimeRetrieveInventoryItemsResponse, showtime, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    def test_method_retrieve_sections(self, client: AliTest2) -> None:
        showtime = client.api.v2.shows.showtimes.retrieve_sections(
            showtime_id=0,
            id=0,
        )
        assert_matches_type(ShowtimeRetrieveSectionsResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_method_retrieve_sections_with_all_params(self, client: AliTest2) -> None:
        showtime = client.api.v2.shows.showtimes.retrieve_sections(
            showtime_id=0,
            id=0,
            chart_key_override="chartKeyOverride",
            include_attributes=True,
            max_seats=0,
            quantity=0,
            remove_unavailable_seats=True,
            sort_by=["NAME"],
        )
        assert_matches_type(ShowtimeRetrieveSectionsResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_retrieve_sections(self, client: AliTest2) -> None:
        response = client.api.v2.shows.showtimes.with_raw_response.retrieve_sections(
            showtime_id=0,
            id=0,
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        showtime = response.parse()
        assert_matches_type(ShowtimeRetrieveSectionsResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_retrieve_sections(self, client: AliTest2) -> None:
        with client.api.v2.shows.showtimes.with_streaming_response.retrieve_sections(
            showtime_id=0,
            id=0,
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            showtime = response.parse()
            assert_matches_type(ShowtimeRetrieveSectionsResponse, showtime, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    def test_method_retrieve_with_rush_availability(self, client: AliTest2) -> None:
        showtime = client.api.v2.shows.showtimes.retrieve_with_rush_availability(
            0,
        )
        assert_matches_type(ShowtimeRetrieveWithRushAvailabilityResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_retrieve_with_rush_availability(self, client: AliTest2) -> None:
        response = client.api.v2.shows.showtimes.with_raw_response.retrieve_with_rush_availability(
            0,
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        showtime = response.parse()
        assert_matches_type(ShowtimeRetrieveWithRushAvailabilityResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_retrieve_with_rush_availability(self, client: AliTest2) -> None:
        with client.api.v2.shows.showtimes.with_streaming_response.retrieve_with_rush_availability(
            0,
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            showtime = response.parse()
            assert_matches_type(ShowtimeRetrieveWithRushAvailabilityResponse, showtime, path=["response"])

        assert cast(Any, response.is_closed) is True


class TestAsyncShowtimes:
    parametrize = pytest.mark.parametrize(
        "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
    )

    @pytest.mark.skip()
    @parametrize
    async def test_method_list(self, async_client: AsyncAliTest2) -> None:
        showtime = await async_client.api.v2.shows.showtimes.list(
            show_id=0,
        )
        assert_matches_type(ShowtimeListResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_method_list_with_all_params(self, async_client: AsyncAliTest2) -> None:
        showtime = await async_client.api.v2.shows.showtimes.list(
            show_id=0,
            end_date=parse_date("2019-12-27"),
            include_no_inventory="includeNoInventory",
            max_price=0,
            min_price=0,
            quantity=0,
            start_date=parse_date("2019-12-27"),
            ticket_type="ticketType",
            use_override_fields=True,
        )
        assert_matches_type(ShowtimeListResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_list(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.api.v2.shows.showtimes.with_raw_response.list(
            show_id=0,
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        showtime = await response.parse()
        assert_matches_type(ShowtimeListResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_list(self, async_client: AsyncAliTest2) -> None:
        async with async_client.api.v2.shows.showtimes.with_streaming_response.list(
            show_id=0,
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            showtime = await response.parse()
            assert_matches_type(ShowtimeListResponse, showtime, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    async def test_method_retrieve_inventory_items(self, async_client: AsyncAliTest2) -> None:
        showtime = await async_client.api.v2.shows.showtimes.retrieve_inventory_items(
            showtime_id=0,
            show_id=0,
        )
        assert_matches_type(ShowtimeRetrieveInventoryItemsResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_retrieve_inventory_items(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.api.v2.shows.showtimes.with_raw_response.retrieve_inventory_items(
            showtime_id=0,
            show_id=0,
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        showtime = await response.parse()
        assert_matches_type(ShowtimeRetrieveInventoryItemsResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_retrieve_inventory_items(self, async_client: AsyncAliTest2) -> None:
        async with async_client.api.v2.shows.showtimes.with_streaming_response.retrieve_inventory_items(
            showtime_id=0,
            show_id=0,
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            showtime = await response.parse()
            assert_matches_type(ShowtimeRetrieveInventoryItemsResponse, showtime, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    async def test_method_retrieve_sections(self, async_client: AsyncAliTest2) -> None:
        showtime = await async_client.api.v2.shows.showtimes.retrieve_sections(
            showtime_id=0,
            id=0,
        )
        assert_matches_type(ShowtimeRetrieveSectionsResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_method_retrieve_sections_with_all_params(self, async_client: AsyncAliTest2) -> None:
        showtime = await async_client.api.v2.shows.showtimes.retrieve_sections(
            showtime_id=0,
            id=0,
            chart_key_override="chartKeyOverride",
            include_attributes=True,
            max_seats=0,
            quantity=0,
            remove_unavailable_seats=True,
            sort_by=["NAME"],
        )
        assert_matches_type(ShowtimeRetrieveSectionsResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_retrieve_sections(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.api.v2.shows.showtimes.with_raw_response.retrieve_sections(
            showtime_id=0,
            id=0,
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        showtime = await response.parse()
        assert_matches_type(ShowtimeRetrieveSectionsResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_retrieve_sections(self, async_client: AsyncAliTest2) -> None:
        async with async_client.api.v2.shows.showtimes.with_streaming_response.retrieve_sections(
            showtime_id=0,
            id=0,
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            showtime = await response.parse()
            assert_matches_type(ShowtimeRetrieveSectionsResponse, showtime, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    async def test_method_retrieve_with_rush_availability(self, async_client: AsyncAliTest2) -> None:
        showtime = await async_client.api.v2.shows.showtimes.retrieve_with_rush_availability(
            0,
        )
        assert_matches_type(ShowtimeRetrieveWithRushAvailabilityResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_retrieve_with_rush_availability(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.api.v2.shows.showtimes.with_raw_response.retrieve_with_rush_availability(
            0,
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        showtime = await response.parse()
        assert_matches_type(ShowtimeRetrieveWithRushAvailabilityResponse, showtime, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_retrieve_with_rush_availability(self, async_client: AsyncAliTest2) -> None:
        async with async_client.api.v2.shows.showtimes.with_streaming_response.retrieve_with_rush_availability(
            0,
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            showtime = await response.parse()
            assert_matches_type(ShowtimeRetrieveWithRushAvailabilityResponse, showtime, path=["response"])

        assert cast(Any, response.is_closed) is True
