import { Component, ElementRef, signal, ViewChild, ViewEncapsulation } from '@angular/core';
import { KnowledgeService } from '../../services/knowledge.service';
import { CommonNzModule } from './../../common.nz.module';
import { BasicDataService } from './../../services/basic.service';
import { SettingService } from './../../services/setting.service';
import { DatavHeaderComponent } from './datav-header/datav-header.component';
import { DigitalLineComponent } from './digital-line/digital-line.component';

@Component({
  selector: 'app-datav',
  standalone: true,
  imports: [CommonNzModule, DatavHeaderComponent, DigitalLineComponent],
  templateUrl: './datav.component.html',
  styleUrl: './datav.component.less',
  encapsulation: ViewEncapsulation.None,
})
export class DatavComponent {
  @ViewChild(DatavHeaderComponent) header!: DatavHeaderComponent;
  @ViewChild('datavContent') datavContent!: ElementRef<HTMLDivElement>;

  serverTime = '';
  constructor(
    private basic: BasicDataService,
    private setting: SettingService,
    private knowledge: KnowledgeService
  ) {
    basic.init();
    setting.init();
    knowledge.init();
  }

  screens: Option<string>[] = [
    { label: '大屏标题一', value: 'screen1' },
    { label: '大屏标题二', value: 'screen2' },
    { label: '大屏标题三', value: 'screen3' },
  ];
  currentScreen = signal<string>(this.screens[0].value);

  onScreenChange(value: string) {
    this.currentScreen.set(value);
  }

  onServerTimeChange(value: string) {
    this.serverTime = value;
  }

  ngAfterViewInit(): void {}
}
