# -*- coding: utf-8 -*-

"""
    apimaticcalculatorlatest

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

from apimaticcalculatorlatest.api_helper import APIHelper
from apimaticcalculatorlatest.configuration import Configuration
from apimaticcalculatorlatest.controllers.base_controller import BaseController
from apimaticcalculatorlatest.http.auth.custom_query_auth import CustomQueryAuth
from apimaticcalculatorlatest.models.fee_tax_validation_setting_response import FeeTaxValidationSettingResponse
from apimaticcalculatorlatest.models.api_responsewithout_data import APIResponsewithoutData

class FeeAndTaxMandatoryAtThePropertyLevelController(BaseController):

    """A Controller to access Endpoints in the apimaticcalculatorlatest API."""


    def getfeeandtaxmandatory(self):
        """Does a GET request to /validation-settings/get-validation.

        This function allows the logged in user to get info about current set
        for all PM properties are fees/taxes set to be mandatory or not.

        Returns:
            FeeTaxValidationSettingResponse: Response from the API. 

        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.

        """

        # Prepare query URL
        _url_path = '/validation-settings/get-validation'
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json'
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        CustomQueryAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, FeeTaxValidationSettingResponse.from_dictionary)

    def create_importorupdatefeeandtaxmandatory(self,
                                                content_type,
                                                body):
        """Does a POST request to /validation-settings/import-update.

        This function allows the logged in user to import or update a fee and
        tax mandatory.

        Args:
            content_type (string): TODO: type description here. Example: 
            body (SetfeeandtaxvalidationsettingRequest): TODO: type
                description here. Example: 

        Returns:
            APIResponsewithoutData: Response from the API. 

        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.

        """

        # Prepare query URL
        _url_path = '/validation-settings/import-update'
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'Content-Type': content_type
        }

        # Prepare and execute request
        _request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
        CustomQueryAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, APIResponsewithoutData.from_dictionary)

    def create_remove_validation_settings(self,
                                          content_type,
                                          body):
        """Does a POST request to /validation-settings/removed.

        This function allows the logged in user to remove any setup on
        property level and to return on default (which is that fee/taxes are
        mandatory). This API call will accept a list of properties.

        Args:
            content_type (string): TODO: type description here. Example: 
            body (PropertyListRequest): TODO: type description here. Example:
                
        Returns:
            APIResponsewithoutData: Response from the API. 

        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.

        """

        # Prepare query URL
        _url_path = '/validation-settings/removed'
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'Content-Type': content_type
        }

        # Prepare and execute request
        _request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
        CustomQueryAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, APIResponsewithoutData.from_dictionary)
