# This file was auto-generated by Fern from our API Definition.

import typing
from json.decoder import JSONDecodeError

from .....core.api_error import ApiError
from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .....core.jsonable_encoder import jsonable_encoder
from .....core.pydantic_utilities import pydantic_v1
from .....core.request_options import RequestOptions
from ....commons.errors.entity_conflict_error import EntityConflictError
from ....commons.errors.entity_not_found_error import EntityNotFoundError
from ....commons.errors.unprocessable_entity_error import UnprocessableEntityError
from ....commons.types.entity_conflict_error_message import EntityConflictErrorMessage
from ....commons.types.entity_not_found_error_message import EntityNotFoundErrorMessage
from ....commons.types.page_token import PageToken
from ....commons.types.sort_direction import SortDirection
from ....commons.types.unprocessable_entity_error_message import UnprocessableEntityErrorMessage
from .types.create_non_insurance_payer_request import CreateNonInsurancePayerRequest
from .types.non_insurance_payer import NonInsurancePayer
from .types.non_insurance_payer_id import NonInsurancePayerId
from .types.non_insurance_payer_page import NonInsurancePayerPage
from .types.non_insurance_payer_sort_field import NonInsurancePayerSortField
from .types.non_insurance_payer_update_request import NonInsurancePayerUpdateRequest
from .types.toggle_non_insurance_payer_enablement_request import ToggleNonInsurancePayerEnablementRequest

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class V1Client:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._client_wrapper = client_wrapper

    def create(
        self, *, request: CreateNonInsurancePayerRequest, request_options: typing.Optional[RequestOptions] = None
    ) -> NonInsurancePayer:
        """
        Parameters
        ----------
        request : CreateNonInsurancePayerRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        NonInsurancePayer

        Examples
        --------
        from candid.client import CandidApiClient
        from candid.resources.non_insurance_payers.v_1 import (
            CreateNonInsurancePayerRequest,
        )

        client = CandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )
        client.non_insurance_payers.v_1.create(
            request=CreateNonInsurancePayerRequest(
                name="string",
                description="string",
                category="string",
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "api/non-insurance-payers/v1",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="POST",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(NonInsurancePayer, _response_json)  # type: ignore
        if "errorName" in _response_json:
            if _response_json["errorName"] == "EntityNotFoundError":
                raise EntityNotFoundError(
                    pydantic_v1.parse_obj_as(EntityNotFoundErrorMessage, _response_json["content"])  # type: ignore
                )
            if _response_json["errorName"] == "EntityConflictError":
                raise EntityConflictError(
                    pydantic_v1.parse_obj_as(EntityConflictErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def toggle_enablement(
        self,
        non_insurance_payer_id: NonInsurancePayerId,
        *,
        request: ToggleNonInsurancePayerEnablementRequest,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> NonInsurancePayer:
        """
        Parameters
        ----------
        non_insurance_payer_id : NonInsurancePayerId

        request : ToggleNonInsurancePayerEnablementRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        NonInsurancePayer

        Examples
        --------
        import uuid

        from candid.client import CandidApiClient
        from candid.resources.non_insurance_payers.v_1 import (
            ToggleNonInsurancePayerEnablementRequest,
        )

        client = CandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )
        client.non_insurance_payers.v_1.toggle_enablement(
            non_insurance_payer_id=uuid.UUID(
                "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
            ),
            request=ToggleNonInsurancePayerEnablementRequest(
                enabled=True,
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            f"api/non-insurance-payers/v1/{jsonable_encoder(non_insurance_payer_id)}/toggle_enablement",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="PATCH",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(NonInsurancePayer, _response_json)  # type: ignore
        if "errorName" in _response_json:
            if _response_json["errorName"] == "EntityNotFoundError":
                raise EntityNotFoundError(
                    pydantic_v1.parse_obj_as(EntityNotFoundErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def get_multi(
        self,
        *,
        name: typing.Optional[str] = None,
        category: typing.Optional[str] = None,
        enabled: typing.Optional[bool] = None,
        sort: typing.Optional[NonInsurancePayerSortField] = None,
        sort_direction: typing.Optional[SortDirection] = None,
        limit: typing.Optional[int] = None,
        page_token: typing.Optional[PageToken] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> NonInsurancePayerPage:
        """
        Parameters
        ----------
        name : typing.Optional[str]

        category : typing.Optional[str]

        enabled : typing.Optional[bool]

        sort : typing.Optional[NonInsurancePayerSortField]

        sort_direction : typing.Optional[SortDirection]

        limit : typing.Optional[int]
            Defaults to 100

        page_token : typing.Optional[PageToken]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        NonInsurancePayerPage

        Examples
        --------
        from candid import SortDirection
        from candid.client import CandidApiClient
        from candid.resources.non_insurance_payers.v_1 import NonInsurancePayerSortField

        client = CandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )
        client.non_insurance_payers.v_1.get_multi(
            name="string",
            category="string",
            enabled=True,
            sort=NonInsurancePayerSortField.NAME,
            sort_direction=SortDirection.ASC,
            limit=1,
            page_token="eyJ0b2tlbiI6IjEiLCJwYWdlX3Rva2VuIjoiMiJ9",
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            "api/non-insurance-payers/v1",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="GET",
            params={
                "name": name,
                "category": category,
                "enabled": enabled,
                "sort": sort,
                "sort_direction": sort_direction,
                "limit": limit,
                "page_token": page_token,
            },
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(NonInsurancePayerPage, _response_json)  # type: ignore
        if "errorName" in _response_json:
            if _response_json["errorName"] == "UnprocessableEntityError":
                raise UnprocessableEntityError(
                    pydantic_v1.parse_obj_as(UnprocessableEntityErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def get(
        self, non_insurance_payer_id: NonInsurancePayerId, *, request_options: typing.Optional[RequestOptions] = None
    ) -> NonInsurancePayer:
        """
        Parameters
        ----------
        non_insurance_payer_id : NonInsurancePayerId

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        NonInsurancePayer

        Examples
        --------
        import uuid

        from candid.client import CandidApiClient

        client = CandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )
        client.non_insurance_payers.v_1.get(
            non_insurance_payer_id=uuid.UUID(
                "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            f"api/non-insurance-payers/v1/{jsonable_encoder(non_insurance_payer_id)}",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="GET",
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(NonInsurancePayer, _response_json)  # type: ignore
        if "errorName" in _response_json:
            if _response_json["errorName"] == "EntityNotFoundError":
                raise EntityNotFoundError(
                    pydantic_v1.parse_obj_as(EntityNotFoundErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def update(
        self,
        non_insurance_payer_id: NonInsurancePayerId,
        *,
        request: NonInsurancePayerUpdateRequest,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> NonInsurancePayer:
        """
        Parameters
        ----------
        non_insurance_payer_id : NonInsurancePayerId

        request : NonInsurancePayerUpdateRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        NonInsurancePayer

        Examples
        --------
        import uuid

        from candid.client import CandidApiClient
        from candid.resources.non_insurance_payers.v_1 import (
            NonInsurancePayerCategoryUpdate,
            NonInsurancePayerDescriptionUpdate,
            NonInsurancePayerUpdateRequest,
        )

        client = CandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )
        client.non_insurance_payers.v_1.update(
            non_insurance_payer_id=uuid.UUID(
                "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
            ),
            request=NonInsurancePayerUpdateRequest(
                name="string",
                description=NonInsurancePayerDescriptionUpdate(),
                category=NonInsurancePayerCategoryUpdate(),
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            f"api/non-insurance-payers/v1/{jsonable_encoder(non_insurance_payer_id)}",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="PATCH",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(NonInsurancePayer, _response_json)  # type: ignore
        if "errorName" in _response_json:
            if _response_json["errorName"] == "EntityNotFoundError":
                raise EntityNotFoundError(
                    pydantic_v1.parse_obj_as(EntityNotFoundErrorMessage, _response_json["content"])  # type: ignore
                )
            if _response_json["errorName"] == "EntityConflictError":
                raise EntityConflictError(
                    pydantic_v1.parse_obj_as(EntityConflictErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def delete(
        self, non_insurance_payer_id: NonInsurancePayerId, *, request_options: typing.Optional[RequestOptions] = None
    ) -> None:
        """
        Parameters
        ----------
        non_insurance_payer_id : NonInsurancePayerId

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        import uuid

        from candid.client import CandidApiClient

        client = CandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )
        client.non_insurance_payers.v_1.delete(
            non_insurance_payer_id=uuid.UUID(
                "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
            ),
        )
        """
        _response = self._client_wrapper.httpx_client.request(
            f"api/non-insurance-payers/v1/{jsonable_encoder(non_insurance_payer_id)}",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="DELETE",
            request_options=request_options,
        )
        if 200 <= _response.status_code < 300:
            return
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if "errorName" in _response_json:
            if _response_json["errorName"] == "EntityNotFoundError":
                raise EntityNotFoundError(
                    pydantic_v1.parse_obj_as(EntityNotFoundErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)


class AsyncV1Client:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._client_wrapper = client_wrapper

    async def create(
        self, *, request: CreateNonInsurancePayerRequest, request_options: typing.Optional[RequestOptions] = None
    ) -> NonInsurancePayer:
        """
        Parameters
        ----------
        request : CreateNonInsurancePayerRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        NonInsurancePayer

        Examples
        --------
        import asyncio

        from candid.client import AsyncCandidApiClient
        from candid.resources.non_insurance_payers.v_1 import (
            CreateNonInsurancePayerRequest,
        )

        client = AsyncCandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )


        async def main() -> None:
            await client.non_insurance_payers.v_1.create(
                request=CreateNonInsurancePayerRequest(
                    name="string",
                    description="string",
                    category="string",
                ),
            )


        asyncio.run(main())
        """
        _response = await self._client_wrapper.httpx_client.request(
            "api/non-insurance-payers/v1",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="POST",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(NonInsurancePayer, _response_json)  # type: ignore
        if "errorName" in _response_json:
            if _response_json["errorName"] == "EntityNotFoundError":
                raise EntityNotFoundError(
                    pydantic_v1.parse_obj_as(EntityNotFoundErrorMessage, _response_json["content"])  # type: ignore
                )
            if _response_json["errorName"] == "EntityConflictError":
                raise EntityConflictError(
                    pydantic_v1.parse_obj_as(EntityConflictErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def toggle_enablement(
        self,
        non_insurance_payer_id: NonInsurancePayerId,
        *,
        request: ToggleNonInsurancePayerEnablementRequest,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> NonInsurancePayer:
        """
        Parameters
        ----------
        non_insurance_payer_id : NonInsurancePayerId

        request : ToggleNonInsurancePayerEnablementRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        NonInsurancePayer

        Examples
        --------
        import asyncio
        import uuid

        from candid.client import AsyncCandidApiClient
        from candid.resources.non_insurance_payers.v_1 import (
            ToggleNonInsurancePayerEnablementRequest,
        )

        client = AsyncCandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )


        async def main() -> None:
            await client.non_insurance_payers.v_1.toggle_enablement(
                non_insurance_payer_id=uuid.UUID(
                    "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
                ),
                request=ToggleNonInsurancePayerEnablementRequest(
                    enabled=True,
                ),
            )


        asyncio.run(main())
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"api/non-insurance-payers/v1/{jsonable_encoder(non_insurance_payer_id)}/toggle_enablement",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="PATCH",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(NonInsurancePayer, _response_json)  # type: ignore
        if "errorName" in _response_json:
            if _response_json["errorName"] == "EntityNotFoundError":
                raise EntityNotFoundError(
                    pydantic_v1.parse_obj_as(EntityNotFoundErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def get_multi(
        self,
        *,
        name: typing.Optional[str] = None,
        category: typing.Optional[str] = None,
        enabled: typing.Optional[bool] = None,
        sort: typing.Optional[NonInsurancePayerSortField] = None,
        sort_direction: typing.Optional[SortDirection] = None,
        limit: typing.Optional[int] = None,
        page_token: typing.Optional[PageToken] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> NonInsurancePayerPage:
        """
        Parameters
        ----------
        name : typing.Optional[str]

        category : typing.Optional[str]

        enabled : typing.Optional[bool]

        sort : typing.Optional[NonInsurancePayerSortField]

        sort_direction : typing.Optional[SortDirection]

        limit : typing.Optional[int]
            Defaults to 100

        page_token : typing.Optional[PageToken]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        NonInsurancePayerPage

        Examples
        --------
        import asyncio

        from candid import SortDirection
        from candid.client import AsyncCandidApiClient
        from candid.resources.non_insurance_payers.v_1 import NonInsurancePayerSortField

        client = AsyncCandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )


        async def main() -> None:
            await client.non_insurance_payers.v_1.get_multi(
                name="string",
                category="string",
                enabled=True,
                sort=NonInsurancePayerSortField.NAME,
                sort_direction=SortDirection.ASC,
                limit=1,
                page_token="eyJ0b2tlbiI6IjEiLCJwYWdlX3Rva2VuIjoiMiJ9",
            )


        asyncio.run(main())
        """
        _response = await self._client_wrapper.httpx_client.request(
            "api/non-insurance-payers/v1",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="GET",
            params={
                "name": name,
                "category": category,
                "enabled": enabled,
                "sort": sort,
                "sort_direction": sort_direction,
                "limit": limit,
                "page_token": page_token,
            },
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(NonInsurancePayerPage, _response_json)  # type: ignore
        if "errorName" in _response_json:
            if _response_json["errorName"] == "UnprocessableEntityError":
                raise UnprocessableEntityError(
                    pydantic_v1.parse_obj_as(UnprocessableEntityErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def get(
        self, non_insurance_payer_id: NonInsurancePayerId, *, request_options: typing.Optional[RequestOptions] = None
    ) -> NonInsurancePayer:
        """
        Parameters
        ----------
        non_insurance_payer_id : NonInsurancePayerId

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        NonInsurancePayer

        Examples
        --------
        import asyncio
        import uuid

        from candid.client import AsyncCandidApiClient

        client = AsyncCandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )


        async def main() -> None:
            await client.non_insurance_payers.v_1.get(
                non_insurance_payer_id=uuid.UUID(
                    "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
                ),
            )


        asyncio.run(main())
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"api/non-insurance-payers/v1/{jsonable_encoder(non_insurance_payer_id)}",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="GET",
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(NonInsurancePayer, _response_json)  # type: ignore
        if "errorName" in _response_json:
            if _response_json["errorName"] == "EntityNotFoundError":
                raise EntityNotFoundError(
                    pydantic_v1.parse_obj_as(EntityNotFoundErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def update(
        self,
        non_insurance_payer_id: NonInsurancePayerId,
        *,
        request: NonInsurancePayerUpdateRequest,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> NonInsurancePayer:
        """
        Parameters
        ----------
        non_insurance_payer_id : NonInsurancePayerId

        request : NonInsurancePayerUpdateRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        NonInsurancePayer

        Examples
        --------
        import asyncio
        import uuid

        from candid.client import AsyncCandidApiClient
        from candid.resources.non_insurance_payers.v_1 import (
            NonInsurancePayerCategoryUpdate,
            NonInsurancePayerDescriptionUpdate,
            NonInsurancePayerUpdateRequest,
        )

        client = AsyncCandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )


        async def main() -> None:
            await client.non_insurance_payers.v_1.update(
                non_insurance_payer_id=uuid.UUID(
                    "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
                ),
                request=NonInsurancePayerUpdateRequest(
                    name="string",
                    description=NonInsurancePayerDescriptionUpdate(),
                    category=NonInsurancePayerCategoryUpdate(),
                ),
            )


        asyncio.run(main())
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"api/non-insurance-payers/v1/{jsonable_encoder(non_insurance_payer_id)}",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="PATCH",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(NonInsurancePayer, _response_json)  # type: ignore
        if "errorName" in _response_json:
            if _response_json["errorName"] == "EntityNotFoundError":
                raise EntityNotFoundError(
                    pydantic_v1.parse_obj_as(EntityNotFoundErrorMessage, _response_json["content"])  # type: ignore
                )
            if _response_json["errorName"] == "EntityConflictError":
                raise EntityConflictError(
                    pydantic_v1.parse_obj_as(EntityConflictErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def delete(
        self, non_insurance_payer_id: NonInsurancePayerId, *, request_options: typing.Optional[RequestOptions] = None
    ) -> None:
        """
        Parameters
        ----------
        non_insurance_payer_id : NonInsurancePayerId

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        import asyncio
        import uuid

        from candid.client import AsyncCandidApiClient

        client = AsyncCandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )


        async def main() -> None:
            await client.non_insurance_payers.v_1.delete(
                non_insurance_payer_id=uuid.UUID(
                    "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
                ),
            )


        asyncio.run(main())
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"api/non-insurance-payers/v1/{jsonable_encoder(non_insurance_payer_id)}",
            base_url=self._client_wrapper.get_environment().candid_api,
            method="DELETE",
            request_options=request_options,
        )
        if 200 <= _response.status_code < 300:
            return
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        if "errorName" in _response_json:
            if _response_json["errorName"] == "EntityNotFoundError":
                raise EntityNotFoundError(
                    pydantic_v1.parse_obj_as(EntityNotFoundErrorMessage, _response_json["content"])  # type: ignore
                )
        raise ApiError(status_code=_response.status_code, body=_response_json)
