# coding: utf-8

"""
    jobsync-api

    Job Sync enables the user to manage jobs (view, create, update and delete jobs) in the Phenom database directly from the ATS, with the updates reflected on the career site.  # noqa: E501

    OpenAPI spec version: 1.0.0
    Contact: shravan.malla@phenompeople.com
    Generated by: phenom
"""

from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from phenom.commons.api_client import ApiClient


class JobsApi(object):
    base_path = "/jobs-api"  # your base path

    def __init__(self, token, gateway_url, apikey, api_client=None):
        if api_client is None:
            api_client = ApiClient(gateway_url + self.base_path, apikey, token)
        self.api_client = api_client

    def delete_job_by_reference_id(self, reference_id, **kwargs):  # noqa: E501
        """Delete Job By Reference 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.delete_job_by_reference_id(reference_id, async_req=True)
        >>> result = thread.get()

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

    def delete_job_by_reference_id_with_http_info(self, reference_id, **kwargs):  # noqa: E501
        """Delete Job By Reference 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.delete_job_by_reference_id_with_http_info(reference_id, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}
        if 'reference_id' in params:
            path_params['referenceId'] = params['reference_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 = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/jobs/{referenceId}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JobSuccessResponse',  # 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_closed_jobs(self, **kwargs):  # noqa: E501
        """Get Closed Jobs By Search Params  # 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_closed_jobs(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str job_id:
        :param str locale:
        :param str category:
        :param str site_type:
        :param str offset:
        :param str limit:
        :return: JobsListSuccessResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_closed_jobs_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_closed_jobs_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_closed_jobs_with_http_info(self, **kwargs):  # noqa: E501
        """Get Closed Jobs By Search Params  # 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_closed_jobs_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str job_id:
        :param str locale:
        :param str category:
        :param str site_type:
        :param str offset:
        :param str limit:
        :return: JobsListSuccessResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['job_id', 'locale', 'category', 'site_type', 'offset', 'limit']  # 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_closed_jobs" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'job_id' in params:
            query_params.append(('jobId', params['job_id']))  # noqa: E501
        if 'locale' in params:
            query_params.append(('locale', params['locale']))  # noqa: E501
        if 'category' in params:
            query_params.append(('category', params['category']))  # noqa: E501
        if 'site_type' in params:
            query_params.append(('siteType', params['site_type']))  # noqa: E501
        if 'offset' in params:
            query_params.append(('offset', params['offset']))  # noqa: E501
        if 'limit' in params:
            query_params.append(('limit', params['limit']))  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/closedJobs', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JobsListSuccessResponse',  # 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_job_by_reference_id(self, reference_id, **kwargs):  # noqa: E501
        """Get Job By Reference 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_job_by_reference_id(reference_id, async_req=True)
        >>> result = thread.get()

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

    def get_job_by_reference_id_with_http_info(self, reference_id, **kwargs):  # noqa: E501
        """Get Job By Reference 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_job_by_reference_id_with_http_info(reference_id, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}
        if 'reference_id' in params:
            path_params['referenceId'] = params['reference_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 = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/jobs/{referenceId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JobSuccessResponse',  # 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_jobs(self, **kwargs):  # noqa: E501
        """Get Jobs By Search Params  # 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_jobs(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str job_id:
        :param str locale:
        :param str category:
        :param str site_type:
        :param str offset:
        :param str limit:
        :return: JobsListSuccessResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_jobs_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_jobs_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_jobs_with_http_info(self, **kwargs):  # noqa: E501
        """Get Jobs By Search Params  # 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_jobs_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str job_id:
        :param str locale:
        :param str category:
        :param str site_type:
        :param str offset:
        :param str limit:
        :return: JobsListSuccessResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['job_id', 'locale', 'category', 'site_type', 'offset', 'limit']  # 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_jobs" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'job_id' in params:
            query_params.append(('jobId', params['job_id']))  # noqa: E501
        if 'locale' in params:
            query_params.append(('locale', params['locale']))  # noqa: E501
        if 'category' in params:
            query_params.append(('category', params['category']))  # noqa: E501
        if 'site_type' in params:
            query_params.append(('siteType', params['site_type']))  # noqa: E501
        if 'offset' in params:
            query_params.append(('offset', params['offset']))  # noqa: E501
        if 'limit' in params:
            query_params.append(('limit', params['limit']))  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/jobs', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JobsListSuccessResponse',  # 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 patch_job_by_reference_id(self, body, reference_id, **kwargs):  # noqa: E501
        """Update Job By Reference 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.patch_job_by_reference_id(body, reference_id, async_req=True)
        >>> result = thread.get()

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

    def patch_job_by_reference_id_with_http_info(self, body, reference_id, **kwargs):  # noqa: E501
        """Update Job By Reference 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.patch_job_by_reference_id_with_http_info(body, reference_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param PatchPayload body: (required)
        :param str reference_id: (required)
        :return: JobSuccessResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'reference_id' in params:
            path_params['referenceId'] = params['reference_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 = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/jobs/{referenceId}', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JobSuccessResponse',  # 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 post_jobs(self, body, **kwargs):  # noqa: E501
        """Create Job  # noqa: E501

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

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

    def post_jobs_with_http_info(self, body, **kwargs):  # noqa: E501
        """Create Job  # noqa: E501

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

        :param async_req bool
        :param PostPayload body: (required)
        :return: JobSuccessResponse
                 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 post_jobs" % 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 `post_jobs`")  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/jobs', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JobSuccessResponse',  # 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)
