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

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.entry import Entry
from .raw_client import AsyncRawCheckCaptureClient, RawCheckCaptureClient
from .types.check_capture_response import CheckCaptureResponse

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


class CheckCaptureClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawCheckCaptureClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawCheckCaptureClient
        """
        return self._raw_client

    def check_processing(
        self,
        *,
        entry_point: Entry,
        front_image: str,
        rear_image: str,
        check_amount: int,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CheckCaptureResponse:
        """
        Captures a check for Remote Deposit Capture (RDC) using the provided check images and details. This endpoint handles the OCR extraction of check data including MICR, routing number, account number, and amount. See the [RDC guide](/developers/developer-guides/pay-in-rdc) for more details.

        Parameters
        ----------
        entry_point : Entry

        front_image : str
            Base64-encoded front check image. Must be JPEG or PNG format and less than 1MB. Image must show the entire check clearly with no partial, blurry, or illegible portions.

        rear_image : str
            Base64-encoded rear check image. Must be JPEG or PNG format and less than 1MB. Image must show the entire check clearly with no partial, blurry, or illegible portions.

        check_amount : int
            Check amount in cents (maximum 32-bit integer value).

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

        Returns
        -------
        CheckCaptureResponse
            Success response with check processing results.

        Examples
        --------
        from payabli import payabli

        client = payabli(
            api_key="YOUR_API_KEY",
        )
        client.check_capture.check_processing(
            entry_point="47abcfea12",
            front_image="/9j/4AAQSkZJRgABAQEASABIAAD...",
            rear_image="/9j/4AAQSkZJRgABAQEASABIAAD...",
            check_amount=12550,
        )
        """
        _response = self._raw_client.check_processing(
            entry_point=entry_point,
            front_image=front_image,
            rear_image=rear_image,
            check_amount=check_amount,
            request_options=request_options,
        )
        return _response.data


class AsyncCheckCaptureClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawCheckCaptureClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawCheckCaptureClient
        """
        return self._raw_client

    async def check_processing(
        self,
        *,
        entry_point: Entry,
        front_image: str,
        rear_image: str,
        check_amount: int,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CheckCaptureResponse:
        """
        Captures a check for Remote Deposit Capture (RDC) using the provided check images and details. This endpoint handles the OCR extraction of check data including MICR, routing number, account number, and amount. See the [RDC guide](/developers/developer-guides/pay-in-rdc) for more details.

        Parameters
        ----------
        entry_point : Entry

        front_image : str
            Base64-encoded front check image. Must be JPEG or PNG format and less than 1MB. Image must show the entire check clearly with no partial, blurry, or illegible portions.

        rear_image : str
            Base64-encoded rear check image. Must be JPEG or PNG format and less than 1MB. Image must show the entire check clearly with no partial, blurry, or illegible portions.

        check_amount : int
            Check amount in cents (maximum 32-bit integer value).

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

        Returns
        -------
        CheckCaptureResponse
            Success response with check processing results.

        Examples
        --------
        import asyncio

        from payabli import Asyncpayabli

        client = Asyncpayabli(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.check_capture.check_processing(
                entry_point="47abcfea12",
                front_image="/9j/4AAQSkZJRgABAQEASABIAAD...",
                rear_image="/9j/4AAQSkZJRgABAQEASABIAAD...",
                check_amount=12550,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.check_processing(
            entry_point=entry_point,
            front_image=front_image,
            rear_image=rear_image,
            check_amount=check_amount,
            request_options=request_options,
        )
        return _response.data
