package com.applemand.zmanim.core.jewcal

import com.google.common.truth.Truth.assertThat
import kotlinx.datetime.LocalDate
import org.junit.Test

class HolidayCatalogTest {

    private val catalog = HolidayCatalog(inIsrael = false)

    @Test fun `Saturday always marks Shabbat`() {
        val saturday = LocalDate(2026, 4, 11)
        val h = catalog.holidaysFor(saturday)
        assertThat(h.map { it.tier }).contains(HolidayTier.SHABBAT)
    }

    @Test fun `Yom Kippur 5787 detected as Yom Tov`() {
        val yk = LocalDate(2026, 9, 21) // 10 Tishrei 5787
        val h = catalog.holidaysFor(yk)
        assertThat(h.any { it.key == Holiday.Key.YOM_KIPPUR }).isTrue()
        assertThat(h.first { it.key == Holiday.Key.YOM_KIPPUR }.tier).isEqualTo(HolidayTier.YOM_TOV)
    }

    @Test fun `filter drops fasts when user disables them`() {
        val tzomGedaliah = LocalDate(2026, 9, 14) // 3 Tishrei 5787
        val raw = catalog.holidaysFor(tzomGedaliah)
        val filtered = catalog.filter(raw, yomTov = true, fast = false, minor = true)
        assertThat(filtered.any { it.tier == HolidayTier.FAST }).isFalse()
    }
}
