# 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 casedev import Casedev, AsyncCasedev
from tests.utils import assert_matches_type
from casedev.types.voice import (
    BoostListExtractResponse,
    BoostListGenerateResponse,
)

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


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

    @parametrize
    def test_method_extract(self, client: Casedev) -> None:
        boost_list = client.voice.boost_list.extract()
        assert_matches_type(BoostListExtractResponse, boost_list, path=["response"])

    @parametrize
    def test_method_extract_with_all_params(self, client: Casedev) -> None:
        boost_list = client.voice.boost_list.extract(
            categories=["person"],
            object_ids=["string"],
            text="text",
            vault_id="vault_id",
        )
        assert_matches_type(BoostListExtractResponse, boost_list, path=["response"])

    @parametrize
    def test_raw_response_extract(self, client: Casedev) -> None:
        response = client.voice.boost_list.with_raw_response.extract()

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

    @parametrize
    def test_streaming_response_extract(self, client: Casedev) -> None:
        with client.voice.boost_list.with_streaming_response.extract() as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            boost_list = response.parse()
            assert_matches_type(BoostListExtractResponse, boost_list, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    def test_method_generate(self, client: Casedev) -> None:
        boost_list = client.voice.boost_list.generate(
            transcription_job_id="transcription_job_id",
        )
        assert_matches_type(BoostListGenerateResponse, boost_list, path=["response"])

    @parametrize
    def test_method_generate_with_all_params(self, client: Casedev) -> None:
        boost_list = client.voice.boost_list.generate(
            transcription_job_id="transcription_job_id",
            categories=["person"],
        )
        assert_matches_type(BoostListGenerateResponse, boost_list, path=["response"])

    @parametrize
    def test_raw_response_generate(self, client: Casedev) -> None:
        response = client.voice.boost_list.with_raw_response.generate(
            transcription_job_id="transcription_job_id",
        )

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

    @parametrize
    def test_streaming_response_generate(self, client: Casedev) -> None:
        with client.voice.boost_list.with_streaming_response.generate(
            transcription_job_id="transcription_job_id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            boost_list = response.parse()
            assert_matches_type(BoostListGenerateResponse, boost_list, path=["response"])

        assert cast(Any, response.is_closed) is True


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

    @parametrize
    async def test_method_extract(self, async_client: AsyncCasedev) -> None:
        boost_list = await async_client.voice.boost_list.extract()
        assert_matches_type(BoostListExtractResponse, boost_list, path=["response"])

    @parametrize
    async def test_method_extract_with_all_params(self, async_client: AsyncCasedev) -> None:
        boost_list = await async_client.voice.boost_list.extract(
            categories=["person"],
            object_ids=["string"],
            text="text",
            vault_id="vault_id",
        )
        assert_matches_type(BoostListExtractResponse, boost_list, path=["response"])

    @parametrize
    async def test_raw_response_extract(self, async_client: AsyncCasedev) -> None:
        response = await async_client.voice.boost_list.with_raw_response.extract()

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

    @parametrize
    async def test_streaming_response_extract(self, async_client: AsyncCasedev) -> None:
        async with async_client.voice.boost_list.with_streaming_response.extract() as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            boost_list = await response.parse()
            assert_matches_type(BoostListExtractResponse, boost_list, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    async def test_method_generate(self, async_client: AsyncCasedev) -> None:
        boost_list = await async_client.voice.boost_list.generate(
            transcription_job_id="transcription_job_id",
        )
        assert_matches_type(BoostListGenerateResponse, boost_list, path=["response"])

    @parametrize
    async def test_method_generate_with_all_params(self, async_client: AsyncCasedev) -> None:
        boost_list = await async_client.voice.boost_list.generate(
            transcription_job_id="transcription_job_id",
            categories=["person"],
        )
        assert_matches_type(BoostListGenerateResponse, boost_list, path=["response"])

    @parametrize
    async def test_raw_response_generate(self, async_client: AsyncCasedev) -> None:
        response = await async_client.voice.boost_list.with_raw_response.generate(
            transcription_job_id="transcription_job_id",
        )

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

    @parametrize
    async def test_streaming_response_generate(self, async_client: AsyncCasedev) -> None:
        async with async_client.voice.boost_list.with_streaming_response.generate(
            transcription_job_id="transcription_job_id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            boost_list = await response.parse()
            assert_matches_type(BoostListGenerateResponse, boost_list, path=["response"])

        assert cast(Any, response.is_closed) is True
