# -*- 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 RadioSettingsController(BaseController):

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


    def get_network_device_wireless_radio_settings(self,
                                                   network_id,
                                                   serial):
        """Does a GET request to /networks/{networkId}/devices/{serial}/wireless/radioSettings.

        Return the radio settings of a device

        Args:
            network_id (string): TODO: type description here. Example: 
            serial (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 = '/networks/{networkId}/devices/{serial}/wireless/radioSettings'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id,
            'serial': serial
        })
        _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_network_device_wireless_radio_settings(self,
                                                      network_id,
                                                      serial,
                                                      update_network_device_wireless_radio_settings=None):
        """Does a PUT request to /networks/{networkId}/devices/{serial}/wireless/radioSettings.

        Update the radio settings of a device

        Args:
            network_id (string): TODO: type description here. Example: 
            serial (string): TODO: type description here. Example: 
            update_network_device_wireless_radio_settings
                (UpdateNetworkDeviceWirelessRadioSettings, 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 = '/networks/{networkId}/devices/{serial}/wireless/radioSettings'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id,
            'serial': serial
        })
        _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_network_device_wireless_radio_settings))
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def get_network_wireless_rf_profiles(self,
                                         network_id,
                                         include_template_profiles=None):
        """Does a GET request to /networks/{networkId}/wireless/rfProfiles.

        List the non-basic RF profiles for this network

        Args:
            network_id (string): TODO: type description here. Example: 
            include_template_profiles (bool, optional): If the network is
                bound to a template, this parameter controls whether or not
                the non-basic RF profiles defined on the template     should
                be included in the response alongside the non-basic profiles
                defined on the bound network. Defaults to false.

        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 = '/networks/{networkId}/wireless/rfProfiles'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            'includeTemplateProfiles': include_template_profiles
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _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_network_wireless_rf_profile(self,
                                           network_id,
                                           create_network_wireless_rf_profile):
        """Does a POST request to /networks/{networkId}/wireless/rfProfiles.

        Creates new RF profile for this network

        Args:
            network_id (string): TODO: type description here. Example: 
            create_network_wireless_rf_profile
                (CreateNetworkWirelessRfProfile): 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 = '/networks/{networkId}/wireless/rfProfiles'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_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_network_wireless_rf_profile))
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def update_network_wireless_rf_profile(self,
                                           network_id,
                                           rf_profile_id,
                                           update_network_wireless_rf_profile=None):
        """Does a PUT request to /networks/{networkId}/wireless/rfProfiles/{rfProfileId}.

        Updates specified RF profile for this network

        Args:
            network_id (string): TODO: type description here. Example: 
            rf_profile_id (string): TODO: type description here. Example: 
            update_network_wireless_rf_profile
                (UpdateNetworkWirelessRfProfile, 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 = '/networks/{networkId}/wireless/rfProfiles/{rfProfileId}'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id,
            'rfProfileId': rf_profile_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_network_wireless_rf_profile))
        CustomHeaderAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return _context.response.raw_body

    def delete_network_wireless_rf_profile(self,
                                           network_id,
                                           rf_profile_id):
        """Does a DELETE request to /networks/{networkId}/wireless/rfProfiles/{rfProfileId}.

        Delete a RF Profile

        Args:
            network_id (string): TODO: type description here. Example: 
            rf_profile_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 = '/networks/{networkId}/wireless/rfProfiles/{rfProfileId}'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id,
            'rfProfileId': rf_profile_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)

    def get_network_wireless_rf_profile(self,
                                        network_id,
                                        rf_profile_id):
        """Does a GET request to /networks/{networkId}/wireless/rfProfiles/{rfProfileId}.

        Return a RF profile

        Args:
            network_id (string): TODO: type description here. Example: 
            rf_profile_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 = '/networks/{networkId}/wireless/rfProfiles/{rfProfileId}'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'networkId': network_id,
            'rfProfileId': rf_profile_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
