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

from ..core.client_wrapper import SyncClientWrapper
from .raw_client import RawTerminalClient
from .actions.client import ActionsClient
from .checkouts.client import CheckoutsClient
from .refunds.client import RefundsClient
import typing
from ..core.request_options import RequestOptions
from ..types.dismiss_terminal_action_response import DismissTerminalActionResponse
from ..types.dismiss_terminal_checkout_response import DismissTerminalCheckoutResponse
from ..types.dismiss_terminal_refund_response import DismissTerminalRefundResponse
from ..core.client_wrapper import AsyncClientWrapper
from .raw_client import AsyncRawTerminalClient
from .actions.client import AsyncActionsClient
from .checkouts.client import AsyncCheckoutsClient
from .refunds.client import AsyncRefundsClient


class TerminalClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawTerminalClient(client_wrapper=client_wrapper)
        self.actions = ActionsClient(client_wrapper=client_wrapper)

        self.checkouts = CheckoutsClient(client_wrapper=client_wrapper)

        self.refunds = RefundsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawTerminalClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawTerminalClient
        """
        return self._raw_client

    def dismiss_terminal_action(
        self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DismissTerminalActionResponse:
        """
        Dismisses a Terminal action request if the status and type of the request permits it.

        See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced-features/custom-workflows/link-and-dismiss-actions) for more details.

        Parameters
        ----------
        action_id : str
            Unique ID for the `TerminalAction` associated with the action to be dismissed.

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

        Returns
        -------
        DismissTerminalActionResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.terminal.dismiss_terminal_action(
            action_id="action_id",
        )
        """
        response = self._raw_client.dismiss_terminal_action(action_id, request_options=request_options)
        return response.data

    def dismiss_terminal_checkout(
        self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DismissTerminalCheckoutResponse:
        """
        Dismisses a Terminal checkout request if the status and type of the request permits it.

        Parameters
        ----------
        checkout_id : str
            Unique ID for the `TerminalCheckout` associated with the checkout to be dismissed.

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

        Returns
        -------
        DismissTerminalCheckoutResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.terminal.dismiss_terminal_checkout(
            checkout_id="checkout_id",
        )
        """
        response = self._raw_client.dismiss_terminal_checkout(checkout_id, request_options=request_options)
        return response.data

    def dismiss_terminal_refund(
        self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DismissTerminalRefundResponse:
        """
        Dismisses a Terminal refund request if the status and type of the request permits it.

        Parameters
        ----------
        terminal_refund_id : str
            Unique ID for the `TerminalRefund` associated with the refund to be dismissed.

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

        Returns
        -------
        DismissTerminalRefundResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.terminal.dismiss_terminal_refund(
            terminal_refund_id="terminal_refund_id",
        )
        """
        response = self._raw_client.dismiss_terminal_refund(terminal_refund_id, request_options=request_options)
        return response.data


class AsyncTerminalClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawTerminalClient(client_wrapper=client_wrapper)
        self.actions = AsyncActionsClient(client_wrapper=client_wrapper)

        self.checkouts = AsyncCheckoutsClient(client_wrapper=client_wrapper)

        self.refunds = AsyncRefundsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawTerminalClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawTerminalClient
        """
        return self._raw_client

    async def dismiss_terminal_action(
        self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DismissTerminalActionResponse:
        """
        Dismisses a Terminal action request if the status and type of the request permits it.

        See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced-features/custom-workflows/link-and-dismiss-actions) for more details.

        Parameters
        ----------
        action_id : str
            Unique ID for the `TerminalAction` associated with the action to be dismissed.

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

        Returns
        -------
        DismissTerminalActionResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.terminal.dismiss_terminal_action(
                action_id="action_id",
            )


        asyncio.run(main())
        """
        response = await self._raw_client.dismiss_terminal_action(action_id, request_options=request_options)
        return response.data

    async def dismiss_terminal_checkout(
        self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DismissTerminalCheckoutResponse:
        """
        Dismisses a Terminal checkout request if the status and type of the request permits it.

        Parameters
        ----------
        checkout_id : str
            Unique ID for the `TerminalCheckout` associated with the checkout to be dismissed.

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

        Returns
        -------
        DismissTerminalCheckoutResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.terminal.dismiss_terminal_checkout(
                checkout_id="checkout_id",
            )


        asyncio.run(main())
        """
        response = await self._raw_client.dismiss_terminal_checkout(checkout_id, request_options=request_options)
        return response.data

    async def dismiss_terminal_refund(
        self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DismissTerminalRefundResponse:
        """
        Dismisses a Terminal refund request if the status and type of the request permits it.

        Parameters
        ----------
        terminal_refund_id : str
            Unique ID for the `TerminalRefund` associated with the refund to be dismissed.

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

        Returns
        -------
        DismissTerminalRefundResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.terminal.dismiss_terminal_refund(
                terminal_refund_id="terminal_refund_id",
            )


        asyncio.run(main())
        """
        response = await self._raw_client.dismiss_terminal_refund(terminal_refund_id, request_options=request_options)
        return response.data
