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

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

    def get_team_funding_accounts(self):
        """Perform a GET request to /team/funding-account.

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

        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("/team/funding-account")
            .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 create_team_funding_account(self,
                                    body):
        """Perform a POST request to /team/funding-account.

        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. Funding account 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("/team/funding-account")
            .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 get_team_funding_account(self,
                                 account_id):
        """Perform a GET request to /team/funding-account/{accountId}.

        Args:
            account_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. Funding account 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("/team/funding-account/{accountId}")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("accountId")
                .value(account_id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def update_team_funding_account(self,
                                    account_id,
                                    body):
        """Perform a PUT request to /team/funding-account/{accountId}.

        Args:
            account_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. Funding account 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("/team/funding-account/{accountId}")
            .http_method(HttpMethodEnum.PUT)
            .template_param(Parameter()
                .key("accountId")
                .value(account_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_team_funding_account(self,
                                    account_id):
        """Perform a DELETE request to /team/funding-account/{accountId}.

        Args:
            account_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. Funding account 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("/team/funding-account/{accountId}")
            .http_method(HttpMethodEnum.DELETE)
            .template_param(Parameter()
                .key("accountId")
                .value(account_id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def post_team_funding_account_file(self,
                                       account_id,
                                       file=None):
        """Perform a POST request to /team/funding-account/{accountId}/file.

        Args:
            account_id (uuid|str): The request template parameter.
            file (typing.BinaryIO, optional): The request form parameter.

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

        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("/team/funding-account/{accountId}/file")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("accountId")
                .value(account_id)
                .is_required(True)
                .should_encode(True))
            .multipart_param(Parameter()
                .key("file")
                .value(file)
                .default_content_type("application/octet-stream"))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def delete_team_funding_account_file(self,
                                         account_id,
                                         file_id):
        """Perform a DELETE request to
        /team/funding-account/{accountId}/file/{fileId}.

        Args:
            account_id (uuid|str): The request template parameter.
            file_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. File 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("/team/funding-account/{accountId}/file/{fileId}")
            .http_method(HttpMethodEnum.DELETE)
            .template_param(Parameter()
                .key("accountId")
                .value(account_id)
                .is_required(True)
                .should_encode(True))
            .template_param(Parameter()
                .key("fileId")
                .value(file_id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()

    def get_team_funding_account_files(self,
                                       account_id):
        """Perform a GET request to /team/funding-account/{accountId}/files.

        Args:
            account_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 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("/team/funding-account/{accountId}/files")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("accountId")
                .value(account_id)
                .is_required(True)
                .should_encode(True))
            .auth(Single("bearerAuth")),
        ).response(
            ResponseHandler()
            .is_api_response(True),
        ).execute()
