import Component from '../../component.js'
import { elementAttributeContains } from '../../../core/utils.js'

export default class CoUxTimepicker extends Component {

  constructor(parent) {
    let selector = 'ux-timepicker';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-timepicker/ux-timepicker.component.html
  }
  get timepicker()  {
    let path = '//div[contains(@class,"ux-timepicker")]';
    return this.currentPath + path;
  }
  async isDatetimepicker() {
    return await elementAttributeContains(this.timepicker, 'class', 'ux-timepicker--centered');
  }
  get hourInputContainer()  {
    let path = '//div[contains(@class,"ux-timepicker-hour")]';
    return this.timepicker + path;
  }
  get hourChevron()  {
    let path = '//a[contains(@class,"ux-timepicker__chevron")]';
    return this.hourInputContainer + path;
  }
  get hourIconChevronUp()  {
    let path = '//span[contains(@class,"eui-icon-chevron-up")]';
    return this.hourInputContainer + path;
  }
  get hourInput()  {
    let path = '//input[contains(@class,"ux-timepicker-input") and contains(@class,"ux-form-control")]';
    return this.hourInputContainer + path;
  }
  get hourIconChevronDown()  {
    let path = '//span[contains(@class,"eui-icon-chevron-down")]';
    return this.hourInputContainer + path;
  }
  get spacer()  {
    let path = '//div[contains(@class,"ux-timepicker-spacer")]';
    return this.timepicker + path;
  }
  get minuteInputContainer()  {
    let path = '//div[contains(@class,"ux-timepicker-minute")]';
    return this.timepicker + path;
  }
  get minuteChevron()  {
    let path = '//a[contains(@class,"ux-timepicker__chevron")]';
    return this.minuteInputContainer + path;
  }
  get minuteIconChevronUp()  {
    let path = '//span[contains(@class,"eui-icon-chevron-up")]';
    return this.minuteInputContainer + path;
  }
  get minuteInput()  {
    let path = '//input[contains(@class,"ux-timepicker-input") and contains(@class,"ux-form-control")]';
    return this.minuteInputContainer + path;
  }
  get minuteIconChevronDown()  {
    let path = '//span[contains(@class,"eui-icon-chevron-down")]';
    return this.minuteInputContainer + path;
  }
}


