# coding: utf-8

"""
    vault/kernel/core_api/proto/v1/accounts/core_api_account_schedule_tags.proto

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # noqa: E501

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

from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from common.vault.oas.api_client import ApiClient


class CoreAPIPaymentOrderSchedulerApi(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 batch_get_payment_orders(self, **kwargs):  # noqa: E501
        """Retrieves one or more PaymentOrder objects based on the PaymentOrder ID or list of payment order IDs.  # noqa: E501

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

        :param async_req bool
        :param list[str] ids: A list of the PaymentOrder IDs to be retrieved. Required; must be non-empty.
        :return: PaymentOrdersBatchGetPaymentOrdersResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.batch_get_payment_orders_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.batch_get_payment_orders_with_http_info(**kwargs)  # noqa: E501
            return data

    def batch_get_payment_orders_with_http_info(self, **kwargs):  # noqa: E501
        """Retrieves one or more PaymentOrder objects based on the PaymentOrder ID or list of payment order IDs.  # noqa: E501

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

        :param async_req bool
        :param list[str] ids: A list of the PaymentOrder IDs to be retrieved. Required; must be non-empty.
        :return: PaymentOrdersBatchGetPaymentOrdersResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['ids']  # 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 batch_get_payment_orders" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'ids' in params:
            query_params.append(('ids', params['ids']))  # noqa: E501
            collection_formats['ids'] = 'multi'  # 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

        # Authentication setting
        auth_settings = ['ApiKeyAuth']  # noqa: E501

        return self.api_client.call_api(
            '/v1/payment-orders:batchGet', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PaymentOrdersBatchGetPaymentOrdersResponse',  # 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 create_payment_order(self, body, **kwargs):  # noqa: E501
        """Creates a new PaymentOrder. On successful validation, the PaymentOrder is sent to be scheduled or executed.  # noqa: E501

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

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

    def create_payment_order_with_http_info(self, body, **kwargs):  # noqa: E501
        """Creates a new PaymentOrder. On successful validation, the PaymentOrder is sent to be scheduled or executed.  # noqa: E501

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

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # 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 = ['ApiKeyAuth']  # noqa: E501

        return self.api_client.call_api(
            '/v1/payment-orders', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PaymentOrdersPaymentOrder',  # 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_payment_order(self, id, **kwargs):  # noqa: E501
        """Retrieves one PaymentOrder object based on the PaymentOrder ID.  # 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_payment_order(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str id: The UUID of the PaymentOrder to get. (required)
        :return: PaymentOrdersPaymentOrder
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_payment_order_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_payment_order_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def get_payment_order_with_http_info(self, id, **kwargs):  # noqa: E501
        """Retrieves one PaymentOrder object based on the PaymentOrder ID.  # 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_payment_order_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str id: The UUID of the PaymentOrder to get. (required)
        :return: PaymentOrdersPaymentOrder
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id']  # 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_payment_order" % 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_payment_order`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']  # noqa: E501

        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

        # Authentication setting
        auth_settings = ['ApiKeyAuth']  # noqa: E501

        return self.api_client.call_api(
            '/v1/payment-orders/{id}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PaymentOrdersPaymentOrder',  # 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 list_payment_orders(self, page_size, **kwargs):  # noqa: E501
        """Lists and filters PaymentOrder objects. Results are returned ordered by descending create timestamp (most recent first).  # noqa: E501

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

        :param async_req bool
        :param int page_size: The number of results to be listed. Required; must be non-zero. Maximum value of 100.  Required. Min: 1. Max: 100. (required)
        :param list[str] types: The PaymentOrderTypes to filter the PaymentOrder on. Optional.
        :param list[str] debtor_account_ids: The internal Vault accounts to filter the PaymentOrder on. Optional.
        :param str page_token: Token of the page the results are to be retrieved from. If empty, returns the first page of results. Optional.
        :return: PaymentOrdersListPaymentOrdersResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.list_payment_orders_with_http_info(page_size, **kwargs)  # noqa: E501
        else:
            (data) = self.list_payment_orders_with_http_info(page_size, **kwargs)  # noqa: E501
            return data

    def list_payment_orders_with_http_info(self, page_size, **kwargs):  # noqa: E501
        """Lists and filters PaymentOrder objects. Results are returned ordered by descending create timestamp (most recent first).  # noqa: E501

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

        :param async_req bool
        :param int page_size: The number of results to be listed. Required; must be non-zero. Maximum value of 100.  Required. Min: 1. Max: 100. (required)
        :param list[str] types: The PaymentOrderTypes to filter the PaymentOrder on. Optional.
        :param list[str] debtor_account_ids: The internal Vault accounts to filter the PaymentOrder on. Optional.
        :param str page_token: Token of the page the results are to be retrieved from. If empty, returns the first page of results. Optional.
        :return: PaymentOrdersListPaymentOrdersResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'types' in params:
            query_params.append(('types', params['types']))  # noqa: E501
            collection_formats['types'] = 'multi'  # noqa: E501
        if 'debtor_account_ids' in params:
            query_params.append(('debtor_account_ids', params['debtor_account_ids']))  # noqa: E501
            collection_formats['debtor_account_ids'] = 'multi'  # noqa: E501
        if 'page_size' in params:
            query_params.append(('page_size', params['page_size']))  # noqa: E501
        if 'page_token' in params:
            query_params.append(('page_token', params['page_token']))  # 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

        # Authentication setting
        auth_settings = ['ApiKeyAuth']  # noqa: E501

        return self.api_client.call_api(
            '/v1/payment-orders', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PaymentOrdersListPaymentOrdersResponse',  # 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 update_payment_order(self, body, payment_order_id, **kwargs):  # noqa: E501
        """Updates an existing PaymentOrder object with a new reference, status, denomination, amount, schedule and/or calendar operation.  # noqa: E501

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

        :param async_req bool
        :param PaymentOrdersUpdatePaymentOrderRequest body: (required)
        :param str payment_order_id: The UUID of the PaymentOrder inside Vault. Optional on resource creation; if it is not set, a UUID will be generated. Required for update calls. (required)
        :return: PaymentOrdersPaymentOrder
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_payment_order_with_http_info(body, payment_order_id, **kwargs)  # noqa: E501
        else:
            (data) = self.update_payment_order_with_http_info(body, payment_order_id, **kwargs)  # noqa: E501
            return data

    def update_payment_order_with_http_info(self, body, payment_order_id, **kwargs):  # noqa: E501
        """Updates an existing PaymentOrder object with a new reference, status, denomination, amount, schedule and/or calendar operation.  # noqa: E501

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

        :param async_req bool
        :param PaymentOrdersUpdatePaymentOrderRequest body: (required)
        :param str payment_order_id: The UUID of the PaymentOrder inside Vault. Optional on resource creation; if it is not set, a UUID will be generated. Required for update calls. (required)
        :return: PaymentOrdersPaymentOrder
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'payment_order_id' in params:
            path_params['payment_order.id'] = params['payment_order_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # 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 = ['ApiKeyAuth']  # noqa: E501

        return self.api_client.call_api(
            '/v1/payment-orders/{payment_order.id}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PaymentOrdersPaymentOrder',  # 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)
