# 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.types.api.v2.customers import (
    Alert,
    AlertListResponse,
)

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


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

    @pytest.mark.skip()
    @parametrize
    def test_method_create(self, client: AliTest2) -> None:
        alert = client.api.v2.customers.alerts.create(
            customer_id="customerId",
            show_id=0,
            ticket_type="RUSH",
        )
        assert_matches_type(Alert, alert, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_create(self, client: AliTest2) -> None:
        response = client.api.v2.customers.alerts.with_raw_response.create(
            customer_id="customerId",
            show_id=0,
            ticket_type="RUSH",
        )

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

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_create(self, client: AliTest2) -> None:
        with client.api.v2.customers.alerts.with_streaming_response.create(
            customer_id="customerId",
            show_id=0,
            ticket_type="RUSH",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            alert = response.parse()
            assert_matches_type(Alert, alert, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    def test_path_params_create(self, client: AliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            client.api.v2.customers.alerts.with_raw_response.create(
                customer_id="",
                show_id=0,
                ticket_type="RUSH",
            )

    @pytest.mark.skip()
    @parametrize
    def test_method_list(self, client: AliTest2) -> None:
        alert = client.api.v2.customers.alerts.list(
            customer_id="customerId",
        )
        assert_matches_type(AlertListResponse, alert, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_method_list_with_all_params(self, client: AliTest2) -> None:
        alert = client.api.v2.customers.alerts.list(
            customer_id="customerId",
            show=0,
        )
        assert_matches_type(AlertListResponse, alert, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_list(self, client: AliTest2) -> None:
        response = client.api.v2.customers.alerts.with_raw_response.list(
            customer_id="customerId",
        )

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

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

            alert = response.parse()
            assert_matches_type(AlertListResponse, alert, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    def test_path_params_list(self, client: AliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            client.api.v2.customers.alerts.with_raw_response.list(
                customer_id="",
            )

    @pytest.mark.skip()
    @parametrize
    def test_method_delete(self, client: AliTest2) -> None:
        alert = client.api.v2.customers.alerts.delete(
            alert_id=0,
            customer_id="customerId",
        )
        assert alert is None

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_delete(self, client: AliTest2) -> None:
        response = client.api.v2.customers.alerts.with_raw_response.delete(
            alert_id=0,
            customer_id="customerId",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        alert = response.parse()
        assert alert is None

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_delete(self, client: AliTest2) -> None:
        with client.api.v2.customers.alerts.with_streaming_response.delete(
            alert_id=0,
            customer_id="customerId",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            alert = response.parse()
            assert alert is None

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    def test_path_params_delete(self, client: AliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            client.api.v2.customers.alerts.with_raw_response.delete(
                alert_id=0,
                customer_id="",
            )


class TestAsyncAlerts:
    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_create(self, async_client: AsyncAliTest2) -> None:
        alert = await async_client.api.v2.customers.alerts.create(
            customer_id="customerId",
            show_id=0,
            ticket_type="RUSH",
        )
        assert_matches_type(Alert, alert, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_create(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.api.v2.customers.alerts.with_raw_response.create(
            customer_id="customerId",
            show_id=0,
            ticket_type="RUSH",
        )

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

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_create(self, async_client: AsyncAliTest2) -> None:
        async with async_client.api.v2.customers.alerts.with_streaming_response.create(
            customer_id="customerId",
            show_id=0,
            ticket_type="RUSH",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            alert = await response.parse()
            assert_matches_type(Alert, alert, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    async def test_path_params_create(self, async_client: AsyncAliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            await async_client.api.v2.customers.alerts.with_raw_response.create(
                customer_id="",
                show_id=0,
                ticket_type="RUSH",
            )

    @pytest.mark.skip()
    @parametrize
    async def test_method_list(self, async_client: AsyncAliTest2) -> None:
        alert = await async_client.api.v2.customers.alerts.list(
            customer_id="customerId",
        )
        assert_matches_type(AlertListResponse, alert, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_method_list_with_all_params(self, async_client: AsyncAliTest2) -> None:
        alert = await async_client.api.v2.customers.alerts.list(
            customer_id="customerId",
            show=0,
        )
        assert_matches_type(AlertListResponse, alert, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_list(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.api.v2.customers.alerts.with_raw_response.list(
            customer_id="customerId",
        )

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

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

            alert = await response.parse()
            assert_matches_type(AlertListResponse, alert, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    async def test_path_params_list(self, async_client: AsyncAliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            await async_client.api.v2.customers.alerts.with_raw_response.list(
                customer_id="",
            )

    @pytest.mark.skip()
    @parametrize
    async def test_method_delete(self, async_client: AsyncAliTest2) -> None:
        alert = await async_client.api.v2.customers.alerts.delete(
            alert_id=0,
            customer_id="customerId",
        )
        assert alert is None

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_delete(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.api.v2.customers.alerts.with_raw_response.delete(
            alert_id=0,
            customer_id="customerId",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        alert = await response.parse()
        assert alert is None

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_delete(self, async_client: AsyncAliTest2) -> None:
        async with async_client.api.v2.customers.alerts.with_streaming_response.delete(
            alert_id=0,
            customer_id="customerId",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            alert = await response.parse()
            assert alert is None

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    async def test_path_params_delete(self, async_client: AsyncAliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            await async_client.api.v2.customers.alerts.with_raw_response.delete(
                alert_id=0,
                customer_id="",
            )
