# coding: utf-8

"""
    Agilicus API

    Agilicus API endpoints  # noqa: E501

    The version of the OpenAPI document: 2021.04.01
    Contact: dev@agilicus.com
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from agilicus_api.api_client import ApiClient
from agilicus_api.exceptions import (
    ApiTypeError,
    ApiValueError
)


class PolicyApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def get_challenge_decision(self, mfa_challenge_question, **kwargs):  # noqa: E501
        """evaluate a policy challenge decision  # noqa: E501

        Evaluate a policy challenge decision to determine if the user should be forced to answer a challenge  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_challenge_decision(mfa_challenge_question, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param MFAChallengeQuestion mfa_challenge_question: The MFA Challenge Question to ask (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: MFAChallengeAnswer
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.get_challenge_decision_with_http_info(mfa_challenge_question, **kwargs)  # noqa: E501

    def get_challenge_decision_with_http_info(self, mfa_challenge_question, **kwargs):  # noqa: E501
        """evaluate a policy challenge decision  # noqa: E501

        Evaluate a policy challenge decision to determine if the user should be forced to answer a challenge  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_challenge_decision_with_http_info(mfa_challenge_question, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param MFAChallengeQuestion mfa_challenge_question: The MFA Challenge Question to ask (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(MFAChallengeAnswer, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['mfa_challenge_question']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_challenge_decision" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'mfa_challenge_question' is set
        if self.api_client.client_side_validation and ('mfa_challenge_question' not in local_var_params or  # noqa: E501
                                                        local_var_params['mfa_challenge_question'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `mfa_challenge_question` when calling `get_challenge_decision`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'mfa_challenge_question' in local_var_params:
            body_params = local_var_params['mfa_challenge_question']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/data/authentication/mfa_policy/allow', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='MFAChallengeAnswer',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def get_enrollment_decision(self, mfa_enrollment_question, **kwargs):  # noqa: E501
        """evaluate a policy enrollment decision  # noqa: E501

        Evaluate a policy enrollment decision to determine if the user should be forced to enroll  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_enrollment_decision(mfa_enrollment_question, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param MFAEnrollmentQuestion mfa_enrollment_question: The MFA Enrollment Question to ask (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: MFAEnrollmentAnswer
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.get_enrollment_decision_with_http_info(mfa_enrollment_question, **kwargs)  # noqa: E501

    def get_enrollment_decision_with_http_info(self, mfa_enrollment_question, **kwargs):  # noqa: E501
        """evaluate a policy enrollment decision  # noqa: E501

        Evaluate a policy enrollment decision to determine if the user should be forced to enroll  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_enrollment_decision_with_http_info(mfa_enrollment_question, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param MFAEnrollmentQuestion mfa_enrollment_question: The MFA Enrollment Question to ask (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(MFAEnrollmentAnswer, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['mfa_enrollment_question']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_enrollment_decision" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'mfa_enrollment_question' is set
        if self.api_client.client_side_validation and ('mfa_enrollment_question' not in local_var_params or  # noqa: E501
                                                        local_var_params['mfa_enrollment_question'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `mfa_enrollment_question` when calling `get_enrollment_decision`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'mfa_enrollment_question' in local_var_params:
            body_params = local_var_params['mfa_enrollment_question']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/data/authentication/enrollment/allow', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='MFAEnrollmentAnswer',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def map_attributes(self, map_attributes_question, **kwargs):  # noqa: E501
        """map attributes of a user  # noqa: E501

        map attributes of a user  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.map_attributes(map_attributes_question, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param MapAttributesQuestion map_attributes_question: The attributes to map and information used to gather them (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: MapAttributesAnswer
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.map_attributes_with_http_info(map_attributes_question, **kwargs)  # noqa: E501

    def map_attributes_with_http_info(self, map_attributes_question, **kwargs):  # noqa: E501
        """map attributes of a user  # noqa: E501

        map attributes of a user  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.map_attributes_with_http_info(map_attributes_question, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param MapAttributesQuestion map_attributes_question: The attributes to map and information used to gather them (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(MapAttributesAnswer, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['map_attributes_question']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method map_attributes" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'map_attributes_question' is set
        if self.api_client.client_side_validation and ('map_attributes_question' not in local_var_params or  # noqa: E501
                                                        local_var_params['map_attributes_question'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `map_attributes_question` when calling `map_attributes`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'map_attributes_question' in local_var_params:
            body_params = local_var_params['map_attributes_question']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/data/authentication/attribute_mapping/map_attributes', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='MapAttributesAnswer',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
