"""
    HCL AppScan on Cloud (v2)

    This API allows you to interact with the service. The API allows you to perform many of the operations available in the UI and more.</br>For authentication, use the relevant APIs in the Account section. A successful authentication response includes a bearer token for use in subsequent API calls. Pasting this token in the 'Access token' field above will automatically add the authorization header to any API call that requires a valid session.

    OpenAPI spec version: v2

    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


import re  # noqa: F401

# python 2 and python 3 compatibility library
from pyasoc.api_client import ApiClient
from pyasoc.models.user_site_common_models_api_key import UserSiteCommonModelsApiKey


class AccountApi:
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

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

    def account_api_key_login(self, api_key: UserSiteCommonModelsApiKey, **kwargs):
        """Users login with API Key

        Used only if you have an active subscription to the service.<br />               Login using this action is allowed only for a user associated with a valid service subscription.<br />               This action returns an access token that can be used as \"Bearer Token\" for accessing the API.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_api_key_login(api_key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UserSiteCommonModelsApiKey api_key: API Key (required)
        :return: UserSiteCommonModelsAccessTokenData
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.account_api_key_login_with_http_info(api_key, **kwargs)
        else:
            (data) = self.account_api_key_login_with_http_info(api_key, **kwargs)
            return data

    def account_api_key_login_with_http_info(self, api_key, **kwargs):
        """Users login with API Key

        Used only if you have an active subscription to the service.<br />               Login using this action is allowed only for a user associated with a valid service subscription.<br />               This action returns an access token that can be used as \"Bearer Token\" for accessing the API.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_api_key_login_with_http_info(api_key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UserSiteCommonModelsApiKey api_key: API Key (required)
        :return: UserSiteCommonModelsAccessTokenData
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["api_key"]
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method account_api_key_login" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'api_key' is set
        if self.api_client.client_side_validation and (
            "api_key" not in params or params["api_key"] is None
        ):
            raise ValueError(
                "Missing the required parameter `api_key` when calling `account_api_key_login`"
            )

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if "api_key" in params:
            body_params = params["api_key"]
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "text/json", "text/csv"]
        )

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(
            ["application/json", "text/json", "application/x-www-form-urlencoded"]
        )

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(
            "/api/V2/Account/ApiKeyLogin",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="UserSiteCommonModelsAccessTokenData",
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )

    def account_get_tenant_info(self, **kwargs):
        """Get information about the Tenant

        Return information about the current user and the Tenant (Organization). Including information about the available subscriptions.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_get_tenant_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: CommonModelsSCXAccountTenantInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.account_get_tenant_info_with_http_info(**kwargs)
        else:
            (data) = self.account_get_tenant_info_with_http_info(**kwargs)
            return data

    def account_get_tenant_info_with_http_info(self, **kwargs):
        """Get information about the Tenant

        Return information about the current user and the Tenant (Organization). Including information about the available subscriptions.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_get_tenant_info_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: CommonModelsSCXAccountTenantInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method account_get_tenant_info" % key
                )
            params[key] = val
        del params["kwargs"]

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "text/json", "text/csv"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/V2/Account/TenantInfo",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="CommonModelsSCXAccountTenantInfo",
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )

    def account_invite(self, invite_model, **kwargs):
        """Invite User to the current organization

        This function is obsolete. Please use POST /api/v2/Account/InviteUsers
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_invite(invite_model, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UserSiteCommonModelsInviteModel invite_model:  (required)
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.account_invite_with_http_info(invite_model, **kwargs)
        else:
            (data) = self.account_invite_with_http_info(invite_model, **kwargs)
            return data

    def account_invite_with_http_info(self, invite_model, **kwargs):
        """Invite User to the current organization

        This function is obsolete. Please use POST /api/v2/Account/InviteUsers
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_invite_with_http_info(invite_model, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UserSiteCommonModelsInviteModel invite_model:  (required)
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["invite_model"]
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'" " to method account_invite" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'invite_model' is set
        if self.api_client.client_side_validation and (
            "invite_model" not in params or params["invite_model"] is None
        ):
            raise ValueError(
                "Missing the required parameter `invite_model` when calling `account_invite`"
            )

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if "invite_model" in params:
            body_params = params["invite_model"]
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "text/json", "text/csv"]
        )

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(
            ["application/json", "text/json", "application/x-www-form-urlencoded"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/V2/Account/Invite",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="object",
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )

    def account_invite_users(self, invite_model, **kwargs):
        """Invite User to the current organization

        Up to 100 users per call. <br />              Connect users with up to 10 AssetGroups
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_invite_users(invite_model, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UserSiteCommonModelsInviteUsersModel invite_model:  (required)
        :return: list[UserSiteCommonModelsInviteResult]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.account_invite_users_with_http_info(invite_model, **kwargs)
        else:
            (data) = self.account_invite_users_with_http_info(invite_model, **kwargs)
            return data

    def account_invite_users_with_http_info(self, invite_model, **kwargs):
        """Invite User to the current organization

        Up to 100 users per call. <br />              Connect users with up to 10 AssetGroups
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_invite_users_with_http_info(invite_model, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UserSiteCommonModelsInviteUsersModel invite_model:  (required)
        :return: list[UserSiteCommonModelsInviteResult]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["invite_model"]
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method account_invite_users" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'invite_model' is set
        if self.api_client.client_side_validation and (
            "invite_model" not in params or params["invite_model"] is None
        ):
            raise ValueError(
                "Missing the required parameter `invite_model` when calling `account_invite_users`"
            )

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if "invite_model" in params:
            body_params = params["invite_model"]
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "text/json", "text/csv"]
        )

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(
            ["application/json", "text/json", "application/x-www-form-urlencoded"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/V2/Account/InviteUsers",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="list[UserSiteCommonModelsInviteResult]",
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )

    def account_logout(self, **kwargs):
        """Logout - revoke the access token

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_logout(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.account_logout_with_http_info(**kwargs)
        else:
            (data) = self.account_logout_with_http_info(**kwargs)
            return data

    def account_logout_with_http_info(self, **kwargs):
        """Logout - revoke the access token

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_logout_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'" " to method account_logout" % key
                )
            params[key] = val
        del params["kwargs"]

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "text/json", "text/csv"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/V2/Account/Logout",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="object",
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )

    def account_subscription_info(self, **kwargs):
        """Get information about the subscription

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_subscription_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: UserSiteCommonModelsSubscriptionInfoModel
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.account_subscription_info_with_http_info(**kwargs)
        else:
            (data) = self.account_subscription_info_with_http_info(**kwargs)
            return data

    def account_subscription_info_with_http_info(self, **kwargs):
        """Get information about the subscription

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_subscription_info_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: UserSiteCommonModelsSubscriptionInfoModel
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method account_subscription_info" % key
                )
            params[key] = val
        del params["kwargs"]

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "text/json", "text/csv"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/V2/Account/SubscriptionInfo",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="UserSiteCommonModelsSubscriptionInfoModel",
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )

    def account_update_tenant_info(self, model, **kwargs):
        """Update tenant info

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_update_tenant_info(model, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UtilitiesStructuresTenantInfoModel model: (required)
        :return: UtilitiesStructuresTenantInfoModel
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.account_update_tenant_info_with_http_info(model, **kwargs)
        else:
            (data) = self.account_update_tenant_info_with_http_info(model, **kwargs)
            return data

    def account_update_tenant_info_with_http_info(self, model, **kwargs):
        """Update tenant info

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.account_update_tenant_info_with_http_info(model, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UtilitiesStructuresTenantInfoModel model: (required)
        :return: UtilitiesStructuresTenantInfoModel
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["model"]
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method account_update_tenant_info" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'model' is set
        if self.api_client.client_side_validation and (
            "model" not in params or params["model"] is None
        ):
            raise ValueError(
                "Missing the required parameter `model` when calling `account_update_tenant_info`"
            )

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if "model" in params:
            body_params = params["model"]
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "text/json", "text/csv"]
        )

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(
            ["application/json", "text/json", "application/x-www-form-urlencoded"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/V2/Account/TenantInfo",
            "PUT",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="UtilitiesStructuresTenantInfoModel",
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )
