# -*- coding: utf-8 -*-

"""
ctddocumentation

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""

from ctddocumentation.api_helper import APIHelper
from ctddocumentation.configuration import Server
from ctddocumentation.controllers.base_controller import BaseController
from apimatic_core.request_builder import RequestBuilder
from apimatic_core.response_handler import ResponseHandler
from apimatic_core.types.parameter import Parameter
from ctddocumentation.http.http_method_enum import HttpMethodEnum
from apimatic_core.authentication.multiple.single_auth import Single
from apimatic_core.authentication.multiple.and_auth_group import And
from apimatic_core.authentication.multiple.or_auth_group import Or
from ctddocumentation.models.get_custom_attribute_categories_response import GetCustomAttributeCategoriesResponse


class CustomAttributesCategoriesController(BaseController):

    """A Controller to access Endpoints in the ctddocumentation API."""
    def __init__(self, config):
        super(CustomAttributesCategoriesController, self).__init__(config)

    def get_custom_attribute_categories(self,
                                        page=None,
                                        per_page=None,
                                        id__exact=None,
                                        site_id__exact=None,
                                        name__contains=None,
                                        name__icontains=None,
                                        description__icontains=None,
                                        description__contains=None,
                                        sort=None):
        """Does a GET request to /ranger/custom_attribute_categories.

        Get Custom Attribute Categories

        Args:
            page (int, optional): TODO: type description here.
            per_page (int, optional): TODO: type description here.
            id__exact (int, optional): TODO: type description here.
            site_id__exact (int, optional): TODO: type description here.
            name__contains (string, optional): TODO: type description here.
            name__icontains (string, optional): TODO: type description here.
            description__icontains (string, optional): TODO: type description
                here.
            description__contains (string, optional): TODO: type description
                here.
            sort (Sort5Enum, optional): TODO: type description here.

        Returns:
            GetCustomAttributeCategoriesResponse: Response from the API.
                Successful Operation

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path('/ranger/custom_attribute_categories')
            .http_method(HttpMethodEnum.GET)
            .query_param(Parameter()
                         .key('page')
                         .value(page))
            .query_param(Parameter()
                         .key('per_page')
                         .value(per_page))
            .query_param(Parameter()
                         .key('id__exact')
                         .value(id__exact))
            .query_param(Parameter()
                         .key('site_id__exact')
                         .value(site_id__exact))
            .query_param(Parameter()
                         .key('name__contains')
                         .value(name__contains))
            .query_param(Parameter()
                         .key('name__icontains')
                         .value(name__icontains))
            .query_param(Parameter()
                         .key('description__icontains')
                         .value(description__icontains))
            .query_param(Parameter()
                         .key('description__contains')
                         .value(description__contains))
            .query_param(Parameter()
                         .key('sort')
                         .value(sort))
            .header_param(Parameter()
                          .key('accept')
                          .value('application/json'))
            .auth(Single('global'))
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetCustomAttributeCategoriesResponse.from_dictionary)
        ).execute()
