# coding: utf-8

"""
    BombBomb

    We make it easy to build relationships using simple videos.

    OpenAPI spec version: 2.0.24005
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

from __future__ import absolute_import

import sys
import os
import re

# python 2 and python 3 compatibility library
from six import iteritems

from ..configuration import Configuration
from ..api_client import ApiClient


class AccountsApi(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):
        config = Configuration()
        if api_client:
            self.api_client = api_client
        else:
            if not config.api_client:
                config.api_client = ApiClient()
            self.api_client = config.api_client

    def account_details(self, **kwargs):
        """
        Get account details.
        Get the details of the user's account.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.account_details(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str email: Your login email address
        :param str pw: Your password
        :param str api_key: Your Api Key
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.account_details_with_http_info(**kwargs)
        else:
            (data) = self.account_details_with_http_info(**kwargs)
            return data

    def account_details_with_http_info(self, **kwargs):
        """
        Get account details.
        Get the details of the user's account.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.account_details_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str email: Your login email address
        :param str pw: Your password
        :param str api_key: Your Api Key
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['email', 'pw', 'api_key']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

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

        resource_path = '/accounts'.replace('{format}', 'json')
        path_params = {}

        query_params = {}
        if 'email' in params:
            query_params['email'] = params['email']
        if 'pw' in params:
            query_params['pw'] = params['pw']
        if 'api_key' in params:
            query_params['api_key'] = params['api_key']

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/x-www-form-urlencoded'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type=None,
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def create_account(self, team_id, first_name, last_name, email_address, company_name, phone, **kwargs):
        """
        Create Account
        Creates a new BombBomb account. This method is currently only available to paid seat admins.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.create_account(team_id, first_name, last_name, email_address, company_name, phone, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str team_id: The team id (required)
        :param str first_name: First name of the user. (required)
        :param str last_name: Last name of the user. (required)
        :param str email_address: Email address of the user. (required)
        :param str company_name: Company of the user. (required)
        :param str phone: Phone number of the user. (required)
        :param str country: Country of the user.
        :param str industry: Industry of the user.
        :param str address: Street Address of the user.
        :param str city: City of the user.
        :param str postal_code: Postal/Zip code of the user.
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.create_account_with_http_info(team_id, first_name, last_name, email_address, company_name, phone, **kwargs)
        else:
            (data) = self.create_account_with_http_info(team_id, first_name, last_name, email_address, company_name, phone, **kwargs)
            return data

    def create_account_with_http_info(self, team_id, first_name, last_name, email_address, company_name, phone, **kwargs):
        """
        Create Account
        Creates a new BombBomb account. This method is currently only available to paid seat admins.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.create_account_with_http_info(team_id, first_name, last_name, email_address, company_name, phone, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str team_id: The team id (required)
        :param str first_name: First name of the user. (required)
        :param str last_name: Last name of the user. (required)
        :param str email_address: Email address of the user. (required)
        :param str company_name: Company of the user. (required)
        :param str phone: Phone number of the user. (required)
        :param str country: Country of the user.
        :param str industry: Industry of the user.
        :param str address: Street Address of the user.
        :param str city: City of the user.
        :param str postal_code: Postal/Zip code of the user.
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['team_id', 'first_name', 'last_name', 'email_address', 'company_name', 'phone', 'country', 'industry', 'address', 'city', 'postal_code']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method create_account" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'team_id' is set
        if ('team_id' not in params) or (params['team_id'] is None):
            raise ValueError("Missing the required parameter `team_id` when calling `create_account`")
        # verify the required parameter 'first_name' is set
        if ('first_name' not in params) or (params['first_name'] is None):
            raise ValueError("Missing the required parameter `first_name` when calling `create_account`")
        # verify the required parameter 'last_name' is set
        if ('last_name' not in params) or (params['last_name'] is None):
            raise ValueError("Missing the required parameter `last_name` when calling `create_account`")
        # verify the required parameter 'email_address' is set
        if ('email_address' not in params) or (params['email_address'] is None):
            raise ValueError("Missing the required parameter `email_address` when calling `create_account`")
        # verify the required parameter 'company_name' is set
        if ('company_name' not in params) or (params['company_name'] is None):
            raise ValueError("Missing the required parameter `company_name` when calling `create_account`")
        # verify the required parameter 'phone' is set
        if ('phone' not in params) or (params['phone'] is None):
            raise ValueError("Missing the required parameter `phone` when calling `create_account`")

        resource_path = '/accounts'.replace('{format}', 'json')
        path_params = {}

        query_params = {}

        header_params = {}

        form_params = []
        local_var_files = {}
        if 'team_id' in params:
            form_params.append(('teamId', params['team_id']))
        if 'first_name' in params:
            form_params.append(('firstName', params['first_name']))
        if 'last_name' in params:
            form_params.append(('lastName', params['last_name']))
        if 'email_address' in params:
            form_params.append(('emailAddress', params['email_address']))
        if 'company_name' in params:
            form_params.append(('companyName', params['company_name']))
        if 'phone' in params:
            form_params.append(('phone', params['phone']))
        if 'country' in params:
            form_params.append(('country', params['country']))
        if 'industry' in params:
            form_params.append(('industry', params['industry']))
        if 'address' in params:
            form_params.append(('address', params['address']))
        if 'city' in params:
            form_params.append(('city', params['city']))
        if 'postal_code' in params:
            form_params.append(('postalCode', params['postal_code']))

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/x-www-form-urlencoded'])

        # Authentication setting
        auth_settings = ['BBOAuth2']

        return self.api_client.call_api(resource_path, 'POST',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='str',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def subscription_purchase_allowed(self, **kwargs):
        """
        Check if subscription purchase allowed.
        Check whether the user can purchase a subscription.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.subscription_purchase_allowed(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str email: Your login email address
        :param str pw: Your password
        :param str api_key: Your Api Key
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.subscription_purchase_allowed_with_http_info(**kwargs)
        else:
            (data) = self.subscription_purchase_allowed_with_http_info(**kwargs)
            return data

    def subscription_purchase_allowed_with_http_info(self, **kwargs):
        """
        Check if subscription purchase allowed.
        Check whether the user can purchase a subscription.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.subscription_purchase_allowed_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str email: Your login email address
        :param str pw: Your password
        :param str api_key: Your Api Key
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['email', 'pw', 'api_key']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

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

        resource_path = '/accounts/purchaseable'.replace('{format}', 'json')
        path_params = {}

        query_params = {}
        if 'email' in params:
            query_params['email'] = params['email']
        if 'pw' in params:
            query_params['pw'] = params['pw']
        if 'api_key' in params:
            query_params['api_key'] = params['api_key']

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/x-www-form-urlencoded'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type=None,
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))
