"""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.http.http_method_enum import (
    HttpMethodEnum,
)


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

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

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

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

        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("/merchant")
            .http_method(HttpMethodEnum.GET)
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def admin_post_merchant(self,
                            body):
        """Perform a POST request to /merchant.

        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. Merchant created

        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("/merchant")
            .http_method(HttpMethodEnum.POST)
            .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 admin_get_merchant(self,
                           merchant_id):
        """Perform a GET request to /merchant/{merchantId}.

        Args:
            merchant_id (uuid|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. Merchant details

        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("/merchant/{merchantId}")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def admin_put_merchant(self,
                           merchant_id,
                           body=None):
        """Perform a PUT request to /merchant/{merchantId}.

        Args:
            merchant_id (uuid|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. Merchant 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("/merchant/{merchantId}")
            .http_method(HttpMethodEnum.PUT)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .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 admin_delete_merchant(self,
                              merchant_id):
        """Perform a DELETE request to /merchant/{merchantId}.

        Args:
            merchant_id (uuid|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. Merchant deleted

        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("/merchant/{merchantId}")
            .http_method(HttpMethodEnum.DELETE)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def post_unassume_merchant(self):
        """Perform a POST request to /merchant/unassume.

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

        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("/merchant/unassume")
            .http_method(HttpMethodEnum.POST)
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def post_assume_merchant(self,
                             merchant_id):
        """Perform a POST request to /merchant/{merchantId}/assume.

        Args:
            merchant_id (uuid|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. Now assuming merchant

        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("/merchant/{merchantId}/assume")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def send_merchant_welcome(self,
                              merchant_id):
        """Perform a POST request to /merchant/{merchantId}/email/welcome.

        Args:
            merchant_id (uuid|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. Welcome email sent

        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("/merchant/{merchantId}/email/welcome")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def send_merchant_ach_rejection(self,
                                    merchant_id):
        """Perform a POST request to /merchant/{merchantId}/email/rejection.

        Args:
            merchant_id (uuid|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. Rejection email sent

        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("/merchant/{merchantId}/email/rejection")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def get_merchant_users(self,
                           merchant_id):
        """Perform a GET request to /merchant/{merchantId}/user.

        Args:
            merchant_id (uuid|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. List of users

        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("/merchant/{merchantId}/user")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def post_attach_user(self,
                         merchant_id,
                         id):
        """Perform a POST request to /merchant/{merchantId}/user/{id}.

        Args:
            merchant_id (uuid|str): The request template parameter.
            id (uuid|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. User attached

        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("/merchant/{merchantId}/user/{id}")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .is_required(True)
                .should_encode(True))
            .template_param(Parameter()
                .key("id")
                .value(id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def put_attach_user(self,
                        merchant_id,
                        id,
                        body=None):
        """Perform a PUT request to /merchant/{merchantId}/user/{id}.

        Args:
            merchant_id (uuid|str): The request template parameter.
            id (uuid|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. Attachment 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("/merchant/{merchantId}/user/{id}")
            .http_method(HttpMethodEnum.PUT)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .is_required(True)
                .should_encode(True))
            .template_param(Parameter()
                .key("id")
                .value(id)
                .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 delete_unattach_user(self,
                             merchant_id,
                             id):
        """Perform a DELETE request to /merchant/{merchantId}/user/{id}.

        Args:
            merchant_id (uuid|str): The request template parameter.
            id (uuid|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. User detached

        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("/merchant/{merchantId}/user/{id}")
            .http_method(HttpMethodEnum.DELETE)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .is_required(True)
                .should_encode(True))
            .template_param(Parameter()
                .key("id")
                .value(id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def admin_put_user_merchant_option(self,
                                       merchant_id,
                                       id,
                                       option):
        """Perform a PUT request to
        /merchant/{merchantId}/user/{id}/merchant_option/{option}.

        Args:
            merchant_id (uuid|str): The request template parameter.
            id (uuid|str): The request template parameter.
            option (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. 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("/merchant/{merchantId}/user/{id}/merchant_option/{option}")
            .http_method(HttpMethodEnum.PUT)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .is_required(True)
                .should_encode(True))
            .template_param(Parameter()
                .key("id")
                .value(id)
                .is_required(True)
                .should_encode(True))
            .template_param(Parameter()
                .key("option")
                .value(option)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def delete_all_scheduled_invoices(self,
                                      merchant_id):
        """Perform a DELETE request to
        /merchant/{merchantId}/scheduled-invoice.

        Args:
            merchant_id (uuid|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. Scheduled invoices
                deleted

        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("/merchant/{merchantId}/scheduled-invoice")
            .http_method(HttpMethodEnum.DELETE)
            .template_param(Parameter()
                .key("merchantId")
                .value(merchant_id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()
