# coding: utf-8

"""
    SCORM Cloud Rest API

    REST API used for SCORM Cloud integrations.  # noqa: E501

    OpenAPI spec version: 2.0
    Contact: systems@rusticisoftware.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import
from deprecated import deprecated

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from rustici_software_cloud_v2.api_client import ApiClient


class ReportingApi(object):
    """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 get_account_info(self, **kwargs):  # noqa: E501
        """Get account information   # noqa: E501

        Returns all of the account information for the specified application.   # 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_account_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: ReportageAccountInfoSchema
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_account_info_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_account_info_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_account_info_with_http_info(self, **kwargs):  # noqa: E501
        """Get account information   # noqa: E501

        Returns all of the account information for the specified application.   # 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_account_info_with_http_info(async_req=True)
        >>> result = thread.get()

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

        all_params = []  # noqa: E501
        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 six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_account_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'])  # 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 = ['APP_NORMAL', 'OAUTH']  # noqa: E501

        return self.api_client.call_api(
            '/reporting/accountInfo', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ReportageAccountInfoSchema',  # noqa: E501
            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 get_reportage_auth_token(self, nav_permission, **kwargs):  # noqa: E501
        """Get a Reportage session authentication token   # noqa: E501

        Returns a session authentication token to use when launching Reportage.   # 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_reportage_auth_token(nav_permission, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str nav_permission: The navigation permissions for this Reportage session (required)
        :param bool admin: Grant admin privileges to this Reportage session
        :return: ReportageAuthTokenSchema
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_reportage_auth_token_with_http_info(nav_permission, **kwargs)  # noqa: E501
        else:
            (data) = self.get_reportage_auth_token_with_http_info(nav_permission, **kwargs)  # noqa: E501
            return data

    def get_reportage_auth_token_with_http_info(self, nav_permission, **kwargs):  # noqa: E501
        """Get a Reportage session authentication token   # noqa: E501

        Returns a session authentication token to use when launching Reportage.   # 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_reportage_auth_token_with_http_info(nav_permission, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str nav_permission: The navigation permissions for this Reportage session (required)
        :param bool admin: Grant admin privileges to this Reportage session
        :return: ReportageAuthTokenSchema
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['nav_permission', 'admin']  # noqa: E501
        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 six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_reportage_auth_token" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'nav_permission' is set
        if ('nav_permission' not in params or
                params['nav_permission'] is None):
            raise ValueError("Missing the required parameter `nav_permission` when calling `get_reportage_auth_token`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'nav_permission' in params:
            query_params.append(('navPermission', params['nav_permission']))  # noqa: E501
        if 'admin' in params:
            query_params.append(('admin', params['admin']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # 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 = ['APP_NORMAL', 'OAUTH']  # noqa: E501

        return self.api_client.call_api(
            '/reporting/reportageAuth', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ReportageAuthTokenSchema',  # noqa: E501
            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 get_reportage_link(self, auth, report_url, **kwargs):  # noqa: E501
        """Get a link to a page in Reportage with the given permissions   # noqa: E501

        Returns the link to use for viewing Reportage.  In order to generate a link, GetReportageAuthToken will need to be called to generate an auth token with the necessary permissions.   # 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_reportage_link(auth, report_url, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str auth: The Reportage authentication token retrieved from a previous call to `GET reportageAuth` (required)
        :param str report_url: The Reportage URL to try and access.  Common values are the Reportage homepage `https://cloud.scorm.com/Reportage/reportage.php?appId={{your appId}}` or a URL pointing to a specific report within Reportage.  The latter type of URL includes lots of parameters of the report, such as the date range, demographic (via tags), specific course or learner, and so on.  (required)
        :return: ReportageLinkSchema
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_reportage_link_with_http_info(auth, report_url, **kwargs)  # noqa: E501
        else:
            (data) = self.get_reportage_link_with_http_info(auth, report_url, **kwargs)  # noqa: E501
            return data

    def get_reportage_link_with_http_info(self, auth, report_url, **kwargs):  # noqa: E501
        """Get a link to a page in Reportage with the given permissions   # noqa: E501

        Returns the link to use for viewing Reportage.  In order to generate a link, GetReportageAuthToken will need to be called to generate an auth token with the necessary permissions.   # 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_reportage_link_with_http_info(auth, report_url, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str auth: The Reportage authentication token retrieved from a previous call to `GET reportageAuth` (required)
        :param str report_url: The Reportage URL to try and access.  Common values are the Reportage homepage `https://cloud.scorm.com/Reportage/reportage.php?appId={{your appId}}` or a URL pointing to a specific report within Reportage.  The latter type of URL includes lots of parameters of the report, such as the date range, demographic (via tags), specific course or learner, and so on.  (required)
        :return: ReportageLinkSchema
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['auth', 'report_url']  # noqa: E501
        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 six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_reportage_link" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'auth' is set
        if ('auth' not in params or
                params['auth'] is None):
            raise ValueError("Missing the required parameter `auth` when calling `get_reportage_link`")  # noqa: E501
        # verify the required parameter 'report_url' is set
        if ('report_url' not in params or
                params['report_url'] is None):
            raise ValueError("Missing the required parameter `report_url` when calling `get_reportage_link`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'auth' in params:
            query_params.append(('auth', params['auth']))  # noqa: E501
        if 'report_url' in params:
            query_params.append(('reportUrl', params['report_url']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # 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 = ['APP_NORMAL', 'OAUTH']  # noqa: E501

        return self.api_client.call_api(
            '/reporting/reportageLink', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ReportageLinkSchema',  # noqa: E501
            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)
