import { DvnDataProvider } from '@dvn/core/providers/DvnDataProvider';
import zoneConfig from './time-zones';
export class DvnDataProviderTimeZone extends DvnDataProvider {
  constructor() {
    super(undefined, undefined, undefined);
    this.options = [];
    this.filteredOptions = [];
    this.searchText = '';
    zoneConfig.forEach(group => {
      group.zones.forEach(zone => {
        this.options.push({
          label: `${zone.name} (${zone.value})`,
          value: zone.value,
        });
      });
    });
    this.filteredOptions = this.options;
  }
  getInitialData() {
    return this.options;
  }
  getData() {
    return Promise.resolve(this.filteredOptions);
  }
  setQuickSearchText(text) {
    this.searchText = text;
    if (text) {
      this.filteredOptions = this.options.filter(option => (option.label.toLocaleLowerCase().includes(text.toLocaleLowerCase())));
    }
    else {
      this.filteredOptions = this.options;
    }
  }
  getQuickSearchText() {
    return this.searchText;
  }
  isQuickSearchEnabled() {
    return true;
  }
}
