import {
  Component,
  computed,
  inject
} from '@angular/core';
import { CommonModule } from '@angular/common';

import { ElementPickerService } from '../../application/services/element-picker.service';
import { APP_TRANSLATE_IMPORTS } from '../../../../core/i18n';
import { ThemeRegistryService } from '../../application/services/theme-registry.service';

@Component({
  selector: 'app-theme-picker-overlay',
  standalone: true,
  imports: [CommonModule, ...APP_TRANSLATE_IMPORTS],
  templateUrl: './theme-picker-overlay.component.html'
})
export class ThemePickerOverlayComponent {
  readonly picker = inject(ElementPickerService);
  readonly registry = inject(ThemeRegistryService);

  readonly hoveredEntry = computed(() => {
    return this.registry.getDefinition(this.picker.hoveredKey());
  });

  cancel(): void {
    this.picker.cancel();
  }
}
