"""staxfattmerchantapi.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: D410, E501, E101, D206
from apimatic_core.authentication.multiple.single_auth import (
    Single,
)
from apimatic_core.request_builder import RequestBuilder
from apimatic_core.response_handler import ResponseHandler
from apimatic_core.types.parameter import Parameter

from staxfattmerchantapi.api_helper import APIHelper
from staxfattmerchantapi.apis.base_api import (
    BaseApi,
)
from staxfattmerchantapi.configuration import (
    Server,
)
from staxfattmerchantapi.exceptions.api_exception import (
    ApiException,
)
from staxfattmerchantapi.http.http_method_enum import (
    HttpMethodEnum,
)


class SelfApi(BaseApi):
    """A Controller to access Endpoints in the staxfattmerchantapi API."""

    def __init__(self, config):
        """Initialize SelfApi object."""
        super(SelfApi, self).__init__(config)

    def get_self_root(self):
        """Perform a GET request to /.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Current user info

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/")
            .http_method(HttpMethodEnum.GET)
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .is_api_response(True)
            .local_error("401",
                "Unauthorized - Invalid or missing authentication token",
                ApiException),
        ).execute()

    def get_self(self):
        """Perform a GET request to /self.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Current user info

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/self")
            .http_method(HttpMethodEnum.GET)
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .is_api_response(True)
            .local_error("401",
                "Unauthorized - Invalid or missing authentication token",
                ApiException),
        ).execute()

    def put_self_user(self,
                      body):
        """Perform a PUT request to /self.

        Args:
            body (Any): The request body parameter.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Updated user

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/self")
            .http_method(HttpMethodEnum.PUT)
            .header_param(Parameter()
                .key("Content-Type")
                .value("application/json"))
            .body_param(Parameter()
                .value(body)
                .is_required(True))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .is_api_response(True),
        ).execute()

    def get_self_list(self):
        """Perform a GET request to /self/list.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. List of self records

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/self/list")
            .http_method(HttpMethodEnum.GET)
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .is_api_response(True),
        ).execute()

    def put_resend_email_verification(self):
        """Perform a PUT request to /self/verify/resend.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Verification email
                resent

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/self/verify/resend")
            .http_method(HttpMethodEnum.PUT)
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def put_acknowledgment(self,
                           key):
        """Perform a PUT request to /self/acknowledge/{key}.

        Args:
            key (str): The request template parameter.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Acknowledgment recorded

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/self/acknowledge/{key}")
            .http_method(HttpMethodEnum.PUT)
            .template_param(Parameter()
                .key("key")
                .value(key)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def put_set_default_merchant(self,
                                 body):
        """Perform a PUT request to /self/default_merchant.

        Args:
            body (PutSetDefaultMerchantRequestBodyJson): The request body parameter.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Default merchant set

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/self/default_merchant")
            .http_method(HttpMethodEnum.PUT)
            .header_param(Parameter()
                .key("Content-Type")
                .value("application/json"))
            .body_param(Parameter()
                .value(body)
                .is_required(True))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def put_self_merchant_option(self,
                                 option,
                                 body=None):
        """Perform a PUT request to /self/merchant_option/{option}.

        Args:
            option (str): The request template parameter.
            body (Any, optional): The request body parameter.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Option updated

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/self/merchant_option/{option}")
            .http_method(HttpMethodEnum.PUT)
            .template_param(Parameter()
                .key("option")
                .value(option)
                .is_required(True)
                .should_encode(True))
            .header_param(Parameter()
                .key("Content-Type")
                .value("application/json"))
            .body_param(Parameter()
                .value(body))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def get_fee_statement_messages(self):
        """Perform a GET request to /self/custom-message/fee-statements.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Fee statement messages

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/self/custom-message/fee-statements")
            .http_method(HttpMethodEnum.GET)
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .is_api_response(True),
        ).execute()

    def get_saasquatch_token(self):
        """Perform a GET request to /saasquatch-token.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Saasquatch token

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/saasquatch-token")
            .http_method(HttpMethodEnum.GET)
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()
