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

"""
    test_meraki

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

from test_meraki.api_helper import APIHelper
from test_meraki.configuration import Configuration
from test_meraki.controllers.base_controller import BaseController
from test_meraki.http.auth.custom_header_auth import CustomHeaderAuth

class DashboardBrandingPoliciesController(BaseController):

    """A Controller to access Endpoints in the test_meraki API."""


    def get_organization_branding_policies(self,
                                           organization_id):
        """Does a GET request to /organizations/{organizationId}/brandingPolicies.

        List the branding policies of an organization

        Args:
            organization_id (string): TODO: type description here. Example: 

        Returns:
            object: 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.

        """

        # Prepare query URL
        _url_path = '/organizations/{organizationId}/brandingPolicies'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'organizationId': organization_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def create_organization_branding_policy(self,
                                            organization_id,
                                            create_organization_branding_policy):
        """Does a POST request to /organizations/{organizationId}/brandingPolicies.

        Add a new branding policy to an organization

        Args:
            organization_id (string): TODO: type description here. Example: 
            create_organization_branding_policy
                (CreateOrganizationBrandingPolicy): TODO: type description
                here. Example: 

        Returns:
            object: 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.

        """

        # Prepare query URL
        _url_path = '/organizations/{organizationId}/brandingPolicies'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'organizationId': organization_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'content-type': 'application/json; charset=utf-8'
        }

        # Prepare and execute request
        _request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(create_organization_branding_policy))
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_organization_branding_policies_priorities(self,
                                                      organization_id):
        """Does a GET request to /organizations/{organizationId}/brandingPolicies/priorities.

        Return the branding policy IDs of an organization in priority order.
        IDs are ordered in ascending order of priority (IDs later in the array
        have higher priority).

        Args:
            organization_id (string): TODO: type description here. Example: 

        Returns:
            object: 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.

        """

        # Prepare query URL
        _url_path = '/organizations/{organizationId}/brandingPolicies/priorities'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'organizationId': organization_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def update_organization_branding_policies_priorities(self,
                                                         organization_id,
                                                         update_organization_branding_policies_priorities):
        """Does a PUT request to /organizations/{organizationId}/brandingPolicies/priorities.

        Update the priority ordering of an organization's branding policies.

        Args:
            organization_id (string): TODO: type description here. Example: 
            update_organization_branding_policies_priorities
                (UpdateOrganizationBrandingPoliciesPriorities): TODO: type
                description here. Example: 

        Returns:
            object: 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.

        """

        # Prepare query URL
        _url_path = '/organizations/{organizationId}/brandingPolicies/priorities'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'organizationId': organization_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'content-type': 'application/json; charset=utf-8'
        }

        # Prepare and execute request
        _request = self.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(update_organization_branding_policies_priorities))
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_organization_branding_policy(self,
                                         organization_id,
                                         branding_policy_id):
        """Does a GET request to /organizations/{organizationId}/brandingPolicies/{brandingPolicyId}.

        Return a branding policy

        Args:
            organization_id (string): TODO: type description here. Example: 
            branding_policy_id (string): TODO: type description here. Example:
                
        Returns:
            object: 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.

        """

        # Prepare query URL
        _url_path = '/organizations/{organizationId}/brandingPolicies/{brandingPolicyId}'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'organizationId': organization_id,
            'brandingPolicyId': branding_policy_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.get(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def update_organization_branding_policy(self,
                                            organization_id,
                                            branding_policy_id,
                                            update_organization_branding_policy=None):
        """Does a PUT request to /organizations/{organizationId}/brandingPolicies/{brandingPolicyId}.

        Update a branding policy

        Args:
            organization_id (string): TODO: type description here. Example: 
            branding_policy_id (string): TODO: type description here. Example:
                            update_organization_branding_policy
                (UpdateOrganizationBrandingPolicy, optional): TODO: type
                description here. Example: 

        Returns:
            object: 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.

        """

        # Prepare query URL
        _url_path = '/organizations/{organizationId}/brandingPolicies/{brandingPolicyId}'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'organizationId': organization_id,
            'brandingPolicyId': branding_policy_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'content-type': 'application/json; charset=utf-8'
        }

        # Prepare and execute request
        _request = self.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(update_organization_branding_policy))
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def delete_organization_branding_policy(self,
                                            organization_id,
                                            branding_policy_id):
        """Does a DELETE request to /organizations/{organizationId}/brandingPolicies/{brandingPolicyId}.

        Delete a branding policy

        Args:
            organization_id (string): TODO: type description here. Example: 
            branding_policy_id (string): TODO: type description here. Example:
                
        Returns:
            void: 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.

        """

        # Prepare query URL
        _url_path = '/organizations/{organizationId}/brandingPolicies/{brandingPolicyId}'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'organizationId': organization_id,
            'brandingPolicyId': branding_policy_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare and execute request
        _request = self.http_client.delete(_query_url)
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)
