"""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 CustomerApi(BaseApi):
    """A Controller to access Endpoints in the staxfattmerchantapi API."""

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

    def get_customers(self,
                      page=None,
                      per_page=None,
                      keywords=None):
        """Perform a GET request to /customer.

        Args:
            page (int, optional): Page number for pagination
            per_page (int, optional): Number of items per page
            keywords (str, optional): The request query parameter.

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

        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("/customer")
            .http_method(HttpMethodEnum.GET)
            .query_param(Parameter()
                .key("page")
                .value(page))
            .query_param(Parameter()
                .key("per_page")
                .value(per_page))
            .query_param(Parameter()
                .key("keywords")
                .value(keywords))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .is_api_response(True),
        ).execute()

    def post_customer(self,
                      body):
        """Perform a POST request to /customer.

        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. Customer 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("/customer")
            .http_method(HttpMethodEnum.POST)
            .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 delete_customer_bulk(self,
                             body=None):
        """Perform a DELETE request to /customer/bulk.

        Args:
            body (DeleteCustomerBulkRequestBodyJson, 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. Customers 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("/customer/bulk")
            .http_method(HttpMethodEnum.DELETE)
            .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 put_restore_customer_bulk(self,
                                  body=None):
        """Perform a PUT request to /customer/restore/bulk.

        Args:
            body (PutRestoreCustomerBulkRequestBodyJson, 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. Customers restored

        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("/customer/restore/bulk")
            .http_method(HttpMethodEnum.PUT)
            .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 post_find_or_create_customer(self,
                                     body):
        """Perform a POST request to /customer/find-or-create.

        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. Customer found or
                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("/customer/find-or-create")
            .http_method(HttpMethodEnum.POST)
            .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_customer(self,
                     id):
        """Perform a GET request to /customer/{id}.

        Args:
            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. Customer 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("/customer/{id}")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("id")
                .value(id)
                .is_required(True)
                .should_encode(True))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .is_api_response(True),
        ).execute()

    def put_customer(self,
                     id,
                     body):
        """Perform a PUT request to /customer/{id}.

        Args:
            id (uuid|str): The request template parameter.
            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. Customer 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("/customer/{id}")
            .http_method(HttpMethodEnum.PUT)
            .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)
                .is_required(True))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def delete_customer(self,
                        id):
        """Perform a DELETE request to /customer/{id}.

        Args:
            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. Customer 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("/customer/{id}")
            .http_method(HttpMethodEnum.DELETE)
            .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_restore_customer(self,
                             id):
        """Perform a PUT request to /customer/{id}/restore.

        Args:
            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. Customer restored

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

    def get_customer_files(self,
                           id):
        """Perform a GET request to /customer/{id}/file.

        Args:
            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 customer files

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

    def get_customer_payment_methods(self,
                                     id):
        """Perform a GET request to /customer/{id}/payment-method.

        Args:
            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 payment methods

        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("/customer/{id}/payment-method")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("id")
                .value(id)
                .is_required(True)
                .should_encode(True))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .is_api_response(True),
        ).execute()

    def merge_customer(self,
                       id,
                       body=None):
        """Perform a POST request to /customer/{id}/merge.

        Args:
            id (uuid|str): The request template parameter.
            body (MergeCustomerRequestBodyJson, 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. Customers merged

        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("/customer/{id}/merge")
            .http_method(HttpMethodEnum.POST)
            .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 merge_duplicate_customers(self,
                                  id,
                                  body=None):
        """Perform a POST request to /customer/{id}/merge-duplicates.

        Args:
            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. Duplicates merged

        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("/customer/{id}/merge-duplicates")
            .http_method(HttpMethodEnum.POST)
            .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 unmerge_customer(self,
                         id,
                         merge_id):
        """Perform a POST request to /customer/{id}/unmerge/{mergeId}.

        Args:
            id (uuid|str): The request template parameter.
            merge_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. Customer unmerged

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