import { Component, Input, Output, EventEmitter } from '@angular/core'
import { NgFor } from '@angular/common'

@Component({
  selector: 'app-stream-cards',
  standalone: true,
  imports: [NgFor],
  templateUrl: './stream-cards.component.html',
  styleUrls: ['./stream-cards.component.scss']
})
export class StreamCardsComponent {

  @Input() streams: string[] = []
  @Input() streamTitles: Record<string, string> = {}
  @Input() streamThumbnails: Record<string, string> = {}
  @Input() isLive!: (stream: string) => boolean
  @Input() startTime!: (stream: string) => string

  @Output() streamSelected = new EventEmitter<string>()

  select(stream: string) {
    this.streamSelected.emit(stream)
  }
}