#  holidays
#  --------
#  A fast, efficient Python library for generating country, province and state
#  specific sets of holidays on the fly. It aims to make determining whether a
#  specific date is a holiday as fast and flexible as possible.
#
#  Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
#           dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
#           ryanss <ryanssdev@icloud.com> (c) 2014-2017
#  Website: https://github.com/vacanza/holidays
#  License: MIT (see LICENSE file)

from unittest import TestCase

from holidays.financial.european_central_bank import EuropeanCentralBank
from tests.common import CommonFinancialTests


class TestEuropeanCentralBank(CommonFinancialTests, TestCase):
    @classmethod
    def setUpClass(cls):
        super().setUpClass(EuropeanCentralBank)

    def test_special_holidays(self):
        self.assertHoliday(
            "1999-12-31",
            "2001-12-31",
        )

    def test_new_years_day(self):
        self.assertHolidayName("New Year's Day", (f"{year}-01-01" for year in self.full_range))

    def test_good_friday(self):
        name = "Good Friday"
        self.assertHolidayName(
            name,
            "2000-04-21",
            "2010-04-02",
            "2018-03-30",
            "2019-04-19",
            "2020-04-10",
            "2021-04-02",
            "2022-04-15",
            "2023-04-07",
            "2024-03-29",
        )
        self.assertHolidayName(name, range(2000, self.end_year))
        self.assertNoHolidayName(name, 1999)

    def test_easter_monday(self):
        name = "Easter Monday"
        self.assertHolidayName(
            name,
            "2000-04-24",
            "2010-04-05",
            "2018-04-02",
            "2019-04-22",
            "2020-04-13",
            "2021-04-05",
            "2022-04-18",
            "2023-04-10",
            "2024-04-01",
        )
        self.assertHolidayName(name, range(2000, self.end_year))
        self.assertNoHolidayName(name, 1999)

    def test_labor_day(self):
        name = "Labour Day"
        self.assertHolidayName(name, (f"{year}-05-01" for year in range(2000, self.end_year)))
        self.assertNoHolidayName(name, 1999)

    def test_christmas_day(self):
        self.assertHolidayName("Christmas Day", (f"{year}-12-25" for year in self.full_range))

    def test_christmas_holiday(self):
        name = "Christmas Holiday"
        self.assertHolidayName(name, (f"{year}-12-26" for year in range(2000, self.end_year)))
        self.assertNoHolidayName(name, 1999)

    def test_1999(self):
        self.assertHolidays(
            EuropeanCentralBank(years=1999),
            ("1999-01-01", "New Year's Day"),
            ("1999-12-25", "Christmas Day"),
            ("1999-12-31", "Additional closing day"),
        )

    def test_2015(self):
        self.assertHolidays(
            EuropeanCentralBank(years=2015),
            ("2015-01-01", "New Year's Day"),
            ("2015-04-03", "Good Friday"),
            ("2015-04-06", "Easter Monday"),
            ("2015-05-01", "Labour Day"),
            ("2015-12-25", "Christmas Day"),
            ("2015-12-26", "Christmas Holiday"),
        )
