/// App-wide state enums for the screen state machine.
library;

/// The 6 states the TV display cycles through.
enum ScreenState {
  /// Normal rotation between MainScreen and Slideshow.
  normal,

  /// Pre-Adzan: Lock to MainScreen, show countdown.
  menujuAdzan,

  /// Adzan alert: Full-screen takeover.
  adzan,

  /// Iqomah countdown (or Friday Khutbah info).
  menujuIqomah,

  /// Black screen during prayer.
  shalat,

  /// Transitioning back to normal after prayer.
  kembaliNormal,
}

/// Named prayer slots used across the app.
enum PrayerName {
  imsak,
  subuh,
  terbit,
  dhuha,
  dzuhur,
  ashar,
  maghrib,
  isya;

  /// Display label — handles Friday override.
  String displayLabel({bool isFriday = false}) {
    if (this == PrayerName.dzuhur && isFriday) return 'JUMAT';
    return id[0].toUpperCase() + id.substring(1);
  }

  /// Safe string identifier to replace .name
  String get id => toString().split('.').last;

  /// Whether this is a fardhu prayer (has iqomah).
  bool get isFardhu =>
      this == PrayerName.subuh ||
      this == PrayerName.dzuhur ||
      this == PrayerName.ashar ||
      this == PrayerName.maghrib ||
      this == PrayerName.isya;
}
