#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright (c) 2021, Cisco Systems
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)


DOCUMENTATION = r"""
---
module: network_devices_query
short_description: Resource module for Network Devices Query
description:
- This module represents an alias of the module network_devices_query_v1
version_added: '6.15.0'
extends_documentation_fragment:
  - cisco.dnac.module
author: Rafael Campos (@racampos)
options:
  aggregateAttributes:
    description: Network Devices Query's aggregateAttributes.
    elements: dict
    suboptions:
      function:
        description: Function.
        type: str
      name:
        description: Name.
        type: str
    type: list
  attributes:
    description: Attributes.
    elements: str
    type: list
  endTime:
    description: End Time.
    type: int
  filters:
    description: Network Devices Query's filters.
    elements: dict
    suboptions:
      key:
        description: Key.
        type: str
      operator:
        description: Operator.
        type: str
      value:
        description: Value.
        type: str
    type: list
  page:
    description: Network Devices Query's page.
    suboptions:
      count:
        description: Count.
        type: int
      limit:
        description: Limit.
        type: int
      offset:
        description: Offset.
        type: int
      sortBy:
        description: Sort By.
        type: str
    type: dict
  startTime:
    description: Start Time.
    type: int
  views:
    description: Views.
    elements: str
    type: list
requirements:
- dnacentersdk >= 2.4.9
- python >= 3.5
seealso:
- name: Cisco DNA Center documentation for Devices GetsTheListOfNetworkDevicesBasedOnTheProvidedComplexFiltersAndAggregationFunctionsV1  # noqa: E501
  description: Complete reference of the GetsTheListOfNetworkDevicesBasedOnTheProvidedComplexFiltersAndAggregationFunctionsV1 API.   # noqa: E501
  link: https://developer.cisco.com/docs/dna-center/#!gets-the-list-of-network-devices-based-on-the-provided-complex-filters-and-aggregation-functions   # noqa: E501
notes:
  - SDK Method used are
    devices.Devices.gets_the_list_of_network_devices_based_on_the_provided_complex_filters_and_aggregation_functions_v1,  # noqa: E501

  - Paths used are
    post /dna/data/api/v1/networkDevices/query,
  - It should be noted that this module is an alias of network_devices_query_v1

"""

EXAMPLES = r"""
- name: Create
  cisco.dnac.network_devices_query:
    dnac_host: "{{dnac_host}}"
    dnac_username: "{{dnac_username}}"
    dnac_password: "{{dnac_password}}"
    dnac_verify: "{{dnac_verify}}"
    dnac_port: "{{dnac_port}}"
    dnac_version: "{{dnac_version}}"
    dnac_debug: "{{dnac_debug}}"
    aggregateAttributes:
    - function: string
      name: string
    attributes:
    - string
    endTime: 0
    filters:
    - key: string
      operator: string
      value: string
    page:
      count: 0
      limit: 0
      offset: 0
      sortBy: string
    startTime: 0
    views:
    - string

"""
RETURN = r"""
dnac_response:
  description: A dictionary or list with the response returned by the Cisco DNAC Python SDK
  returned: always
  type: dict
  sample: >
    {
      "response": [
        {
          "id": "string",
          "name": "string",
          "managementIpAddress": "string",
          "platformId": "string",
          "deviceFamily": "string",
          "serialNumber": "string",
          "macAddress": "string",
          "deviceSeries": "string",
          "softwareVersion": "string",
          "productVendor": "string",
          "deviceRole": "string",
          "deviceType": "string",
          "communicationState": "string",
          "collectionStatus": "string",
          "haStatus": "string",
          "lastBootTime": 0,
          "siteHierarchyId": "string",
          "siteHierarchy": "string",
          "siteId": "string",
          "deviceGroupHierarchyId": "string",
          "tagNames": [
            "string"
          ],
          "stackType": "string",
          "osType": "string",
          "ringStatus": true,
          "maintenanceModeEnabled": true,
          "upTime": 0,
          "ipv4Address": "string",
          "ipv6Address": "string",
          "redundancyMode": "string",
          "featureFlagList": [
            "string"
          ],
          "haLastResetReason": "string",
          "redundancyPeerStateDerived": "string",
          "redundancyPeerState": "string",
          "redundancyStateDerived": "string",
          "redundancyState": "string",
          "wiredClientCount": 0,
          "wirelessClientCount": 0,
          "portCount": 0,
          "clientCount": 0,
          "apDetails": {
            "connectedWlcName": "string",
            "policyTagName": "string",
            "apOperationalState": "string",
            "powerSaveMode": "string",
            "operationalMode": "string",
            "resetReason": "string",
            "protocol": "string",
            "powerMode": "string",
            "connectedTime": 0,
            "ledFlashEnabled": true,
            "ledFlashSeconds": 0,
            "subMode": "string",
            "homeApEnabled": true,
            "powerType": "string",
            "apType": "string",
            "adminState": "string",
            "icapCapability": "string",
            "regulatoryDomain": "string",
            "ethernetMac": "string",
            "rfTagName": "string",
            "siteTagName": "string",
            "powerSaveModeCapable": "string",
            "powerProfile": "string",
            "flexGroup": "string",
            "powerCalendarProfile": "string",
            "apGroup": "string",
            "radios": [
              {
                "id": "string",
                "band": "string",
                "noise": 0,
                "airQuality": 0,
                "interference": 0,
                "trafficUtil": 0,
                "utilization": 0,
                "clientCount": 0
              }
            ]
          },
          "metricsDetails": {
            "overallHealthScore": 0,
            "overallFabricScore": 0,
            "cpuUtilization": 0,
            "cpuScore": 0,
            "memoryUtilization": 0,
            "memoryScore": 0,
            "avgTemperature": 0,
            "maxTemperature": 0,
            "discardScore": 0,
            "discardInterfaces": [
              "string"
            ],
            "errorScore": 0,
            "errorInterfaces": [
              "string"
            ],
            "interDeviceLinkScore": 0,
            "interDeviceConnectedDownInterfaces": [
              "string"
            ],
            "linkUtilizationScore": 0,
            "highLinkUtilizationInterfaces": [
              "string"
            ],
            "freeTimerScore": 0,
            "freeTimer": 0,
            "packetPoolScore": 0,
            "packetPool": 0,
            "freeMemoryBufferScore": 0,
            "freeMemoryBuffer": 0,
            "wqePoolScore": 0,
            "wqePool": 0,
            "apCount": 0,
            "noiseScore": 0,
            "utilizationScore": 0,
            "interferenceScore": 0,
            "airQualityScore": 0
          },
          "fabricDetails": {
            "fabricRole": [
              "string"
            ],
            "fabricSiteName": "string",
            "transitFabrics": [
              "string"
            ]
          },
          "aggregateAttributes": [
            {
              "name": "string",
              "function": "string",
              "value": 0
            }
          ]
        }
      ],
      "page": {
        "limit": 0,
        "offset": 0,
        "count": 0,
        "sortBy": "string",
        "order": "string"
      },
      "version": "string"
    }
"""
