"""
Generated by Sideko (sideko.dev)
"""

import typing

from magic_hour.core import (
    AsyncBaseClient,
    RequestOptions,
    SyncBaseClient,
    default_request_options,
    to_encodable,
)
from magic_hour.types import models, params


class AiImageUpscalerClient:
    def __init__(self, *, base_client: SyncBaseClient):
        self._base_client = base_client
        # register sync resources

    # register sync api methods
    def create(
        self,
        *,
        data: typing.Optional[params.PostV1AiImageUpscalerBody] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> models.PostV1AiImageUpscalerResponse:
        """
        Upscale your image using AI. Each 2x upscale costs 50 frames, and 4x upscale costs 200 frames.

        POST /v1/ai-image-upscaler
        """

        # start -- build request data
        _json = to_encodable(
            item=data, dump_with=params._SerializerPostV1AiImageUpscalerBody
        )
        # end -- build request data

        # start -- send sync request
        return self._base_client.request(
            method="POST",
            path="/v1/ai-image-upscaler",
            auth_names=["bearerAuth"],
            json=_json,
            cast_to=models.PostV1AiImageUpscalerResponse,
            request_options=request_options or default_request_options(),
        )
        # end -- send sync request


class AsyncAiImageUpscalerClient:
    def __init__(self, *, base_client: AsyncBaseClient):
        self._base_client = base_client
        # register async resources

    # register async api methods
    async def create(
        self,
        *,
        data: typing.Optional[params.PostV1AiImageUpscalerBody] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> models.PostV1AiImageUpscalerResponse:
        """
        Upscale your image using AI. Each 2x upscale costs 50 frames, and 4x upscale costs 200 frames.

        POST /v1/ai-image-upscaler
        """

        # start -- build request data
        _json = to_encodable(
            item=data, dump_with=params._SerializerPostV1AiImageUpscalerBody
        )
        # end -- build request data

        # start -- send async request
        return await self._base_client.request(
            method="POST",
            path="/v1/ai-image-upscaler",
            auth_names=["bearerAuth"],
            json=_json,
            cast_to=models.PostV1AiImageUpscalerResponse,
            request_options=request_options or default_request_options(),
        )
        # end -- send async request
