import Component  from '../component.js'
import CoUxPieChartLegendItem from '../7x/ux-pie-chart-legend-item.js'

export default class CoUxPieChart extends Component {
  constructor(parent) {
    let selector = 'ux-pie-chart';
    super(parent, selector);
    // component link
    // https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/core/src/lib/commons/ux-components/ux-pie-chart/ux-pie-chart.component.html?at=support/7.x
  }

  get chartContainer() {
    return this.currentPath + '//*[contains(@data-e2e,"ux-pie-chart-container")]';
  }

  get chartTitle() {
    return this.currentPath + '//div[contains(@class,"chart-title")]';
  }

  async isShowLabel() {
    return await (await $(this.chartContainer + '//div[contains(@class,"chart-inner-labels")]')).isExisting();
  }

  get label() {
    return this.chartContainer + '//div[contains(@class,"chart-inner-labels")]';
  }

  get chartLegend() {
    return this.currentPath + '//ul[contains(@data-e2e,"ux-pie-chart-legend")]';
  }

  get coUxPieChartLegendItem() {
    return new CoUxPieChartLegendItem(this.chartLegend);
  }

  get pChart() {
    return this.chartContainer + '//p-chart';
  }

  async chartType() {
    return await (await $(this.pChart)).getAttribute('type');
  }
}


