# coding: utf-8

"""
    BombBomb

    We make it easy to build relationships using simple videos.

    OpenAPI spec version: 2.0.20679
    
    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 PromptsApi(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 create_video_email_prompt(self, prompt, **kwargs):
        """
        Prompts user to send a video
        Sends the account holder an email prompting them to add a video to a scheduled outgoing message. Recipients, content and timing is all preset for the user.

        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_video_email_prompt(prompt, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param VideoEmailPrompt prompt: The Video Email Prompt to be created (required)
        :return: VideoEmailPrompt
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.create_video_email_prompt_with_http_info(prompt, **kwargs)
        else:
            (data) = self.create_video_email_prompt_with_http_info(prompt, **kwargs)
            return data

    def create_video_email_prompt_with_http_info(self, prompt, **kwargs):
        """
        Prompts user to send a video
        Sends the account holder an email prompting them to add a video to a scheduled outgoing message. Recipients, content and timing is all preset for the user.

        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_video_email_prompt_with_http_info(prompt, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param VideoEmailPrompt prompt: The Video Email Prompt to be created (required)
        :return: VideoEmailPrompt
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['prompt']
        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_video_email_prompt" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'prompt' is set
        if ('prompt' not in params) or (params['prompt'] is None):
            raise ValueError("Missing the required parameter `prompt` when calling `create_video_email_prompt`")

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

        query_params = {}

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'prompt' in params:
            body_params = params['prompt']

        # 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([])

        # 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='VideoEmailPrompt',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def get_video_email_prompt(self, id, **kwargs):
        """
        Gets a prompt
        Gets a prompt

        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.get_video_email_prompt(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: The Id of the prompt (required)
        :return: VideoEmailPrompt
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_video_email_prompt_with_http_info(id, **kwargs)
        else:
            (data) = self.get_video_email_prompt_with_http_info(id, **kwargs)
            return data

    def get_video_email_prompt_with_http_info(self, id, **kwargs):
        """
        Gets a prompt
        Gets a prompt

        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.get_video_email_prompt_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: The Id of the prompt (required)
        :return: VideoEmailPrompt
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id']
        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 get_video_email_prompt" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if ('id' not in params) or (params['id'] is None):
            raise ValueError("Missing the required parameter `id` when calling `get_video_email_prompt`")

        resource_path = '/prompt/{id}'.replace('{format}', 'json')
        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']

        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'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type([])

        # Authentication setting
        auth_settings = ['BBOAuth2']

        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='VideoEmailPrompt',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def respond_to_video_email_prompt(self, id, choice, **kwargs):
        """
        Respond to a prompt
        Respond to a prompt by either adding a video, sending without a video or cancelling the prompt.

        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.respond_to_video_email_prompt(id, choice, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: The id of the prompt. (required)
        :param str choice: The users' selection. Can be: WithVideo, WithoutVideo, Cancel (required)
        :param str video_id: The id of the video.
        :return: VideoEmailPrompt
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.respond_to_video_email_prompt_with_http_info(id, choice, **kwargs)
        else:
            (data) = self.respond_to_video_email_prompt_with_http_info(id, choice, **kwargs)
            return data

    def respond_to_video_email_prompt_with_http_info(self, id, choice, **kwargs):
        """
        Respond to a prompt
        Respond to a prompt by either adding a video, sending without a video or cancelling the prompt.

        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.respond_to_video_email_prompt_with_http_info(id, choice, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: The id of the prompt. (required)
        :param str choice: The users' selection. Can be: WithVideo, WithoutVideo, Cancel (required)
        :param str video_id: The id of the video.
        :return: VideoEmailPrompt
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', 'choice', 'video_id']
        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 respond_to_video_email_prompt" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if ('id' not in params) or (params['id'] is None):
            raise ValueError("Missing the required parameter `id` when calling `respond_to_video_email_prompt`")
        # verify the required parameter 'choice' is set
        if ('choice' not in params) or (params['choice'] is None):
            raise ValueError("Missing the required parameter `choice` when calling `respond_to_video_email_prompt`")

        resource_path = '/prompt/{id}/response'.replace('{format}', 'json')
        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']

        query_params = {}

        header_params = {}

        form_params = []
        local_var_files = {}
        if 'video_id' in params:
            form_params.append(('videoId', params['video_id']))
        if 'choice' in params:
            form_params.append(('choice', params['choice']))

        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([])

        # Authentication setting
        auth_settings = []

        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='VideoEmailPrompt',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))
