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

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

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

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

    def admin_post_user(self,
                        body):
        """Perform a POST request to /user.

        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. User 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("/user")
            .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_user(self,
                       id):
        """Perform a GET request to /user/{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. User 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("/user/{id}")
            .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 admin_put_user(self,
                       id,
                       body=None):
        """Perform a PUT request to /user/{id}.

        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. User 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("/user/{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))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def admin_delete_user(self,
                          id):
        """Perform a DELETE request to /user/{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. User 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("/user/{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 admin_put_resend_verification(self,
                                      id):
        """Perform a PUT request to /user/{id}/verify.

        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. 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("/user/{id}/verify")
            .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 admin_restore_user(self,
                           id):
        """Perform a PUT request to /user/{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. User 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("/user/{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 admin_get_weekly_summaries(self,
                                   id):
        """Perform a GET request to /user/{id}/weeklysummary.

        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 weekly summaries

        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("/user/{id}/weeklysummary")
            .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()
