import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';

export interface AmbientEventData {
  type: 'injury' | 'sacrifice' | 'mission-complete' | 'perk-acquired';
  description: string;
}

const EVENT_META: Record<AmbientEventData['type'], { glyph: string; label: string }> = {
  'injury':          { glyph: '◈', label: 'Injured' },
  'sacrifice':       { glyph: '✕', label: 'Sacrificed' },
  'mission-complete':{ glyph: '◆', label: 'Mission complete' },
  'perk-acquired':   { glyph: '⬡', label: 'Perk acquired' },
};

@Component({
  selector: 'app-ambient-event',
  standalone: true,
  changeDetection: ChangeDetectionStrategy.OnPush,
  templateUrl: './ambient-event.component.html',
  styleUrl: './ambient-event.component.css',
})
export class AmbientEventComponent {
  event = input.required<AmbientEventData>();
  dismissed = output<void>();

  protected meta = computed(() => EVENT_META[this.event().type]);
}
