/*
* Copyright (c) 2021 Xilinx, Inc.
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 
* associated documentation files (the "Software"), to deal in the Software without restriction, including 
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
* copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to 
* the following conditions: 
* 
* The above copyright notice and this permission notice shall be included in all copies or substantial 
* portions of the Software. 
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* 
*
*
*/
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
import './shared-styles.js';
class PerformanceWidget extends PolymerElement {
  static get template() {
    return html`
    <style include="shared-styles">
    </style>
    <div class="card">
      <custom-tab lists={{lists}}></custom-tab>
    </div>
    `;
  }

  static get properties() {
    return {
      lists: {
        type: Array,
        value: [],
      }
    };
  }

  connectedCallback() {
    super.connectedCallback();
    this.lists = [
      {
        key : "perf_config",
        permission : true,
        displayname : "PMC"
      },
      {
        key : "perf_config",
        permission : true,
        displayname : "LPD",
      },
      {
        key : "perf_config",
        permission : true,
        displayname : "FPD",
      },
      {
        key : "perf_config",
        permission : true,
        displayname : "CPM"
      },
      {
        key : "perf_config",
        permission : true,
        displayname : "DDRMC0",
      },
      {
        key : "perf_config",
        permission : true,
        displayname : "DDRMC1",
      },
      {
        key : "perf_config",
        permission : true,
        displayname : "DDRMC2",
      },
      // {
      //   key : "perf_config",
      //   permission : true,
      //   displayname : "DDRMC3",
      // },
      {
        key : "perf_config",
        permission : true,
        displayname : "NoC",
      },
      {
        key : "perf_config",
        permission : false,
        displayname : "AI Engine",
      },
      {
        key : "perf_config",
        permission : true,
        displayname : "PL",
      }
    ];
    let perfList = [
      { "displayname": "PMC", "permission": true, "status": true, "key": 'pmc_data' },
      { "displayname": "LPD", "permission": true, "status": true, "key": 'lpd_data' },
      { "displayname": "FPD", "permission": true, "status": true, "key": 'fpd_data' },
      { "displayname": "CPM", "permission": true, "status": true, "key": 'cpm_tabs' },
      { "displayname": "DDRMC0", "permission": false, "status": true, "key": 'ddr0_data' },
      { "displayname": "DDRMC1", "permission": false, "status": true, "key": 'ddrmc1_data' },
      { "displayname": "DDRMC2", "permission": false, "status": true, "key": 'ddrmc2_data' },
      { "displayname": "DDRMC3", "permission": false, "status": true, "key": 'ddrmc3_data' },
      { "displayname": "NoC", "permission": true, "status": true, "key": 'noc_data' },
      { "displayname": "AI Engine", "permission": false, "status": true, "key": 'aiengine_data' },
      { "displayname": "PL", "permission": true, "status": true, "key": 'pl_data' }
    ];
    if (perfList && perfList.length > 0) {
      const list = _.where(perfList, {permission : true});
      this.lists = list;
    }
    import('./shared/custom_tab');
  }

  ready() {
    super.ready();
  }
}

window.customElements.define('performance-data', PerformanceWidget);