local _, addonTable = ...

local CONSTANTS = Rarity.Enum
local pairs = pairs

local HolidayEvents = {
	fileDataTexturesToLegacyIconPath = {
		[CONSTANTS.ART_TEXTURES.BREWFEST] = CONSTANTS.HOLIDAY_TEXTURES.BREWFEST,
		[CONSTANTS.ART_TEXTURES.BREWFEST_END] = CONSTANTS.HOLIDAY_TEXTURES.BREWFEST,
		[CONSTANTS.ART_TEXTURES.BREWFEST_ONGOING] = CONSTANTS.HOLIDAY_TEXTURES.BREWFEST,
		[CONSTANTS.ART_TEXTURES.BREWFEST_START] = CONSTANTS.HOLIDAY_TEXTURES.BREWFEST,

		[CONSTANTS.ART_TEXTURES.DMF_ELWYNN_END] = CONSTANTS.HOLIDAY_TEXTURES.DARKMOON_FAIRE,
		[CONSTANTS.ART_TEXTURES.DMF_ELWYNN_ONGOING] = CONSTANTS.HOLIDAY_TEXTURES.DARKMOON_FAIRE,
		[CONSTANTS.ART_TEXTURES.DMF_ELWYNN_START] = CONSTANTS.HOLIDAY_TEXTURES.DARKMOON_FAIRE,
		[CONSTANTS.ART_TEXTURES.DMF_MULGORE_END] = CONSTANTS.HOLIDAY_TEXTURES.DARKMOON_FAIRE,
		[CONSTANTS.ART_TEXTURES.DMF_MULGORE_ONGOING] = CONSTANTS.HOLIDAY_TEXTURES.DARKMOON_FAIRE,
		[CONSTANTS.ART_TEXTURES.DMF_MULGORE_START] = CONSTANTS.HOLIDAY_TEXTURES.DARKMOON_FAIRE,
		[CONSTANTS.ART_TEXTURES.DMF_ONGOING] = CONSTANTS.HOLIDAY_TEXTURES.DARKMOON_FAIRE,
		[CONSTANTS.ART_TEXTURES.DMF_TEROKKAR_END] = CONSTANTS.HOLIDAY_TEXTURES.DARKMOON_FAIRE,
		[CONSTANTS.ART_TEXTURES.DMF_TEROKKAR_ONGOING] = CONSTANTS.HOLIDAY_TEXTURES.DARKMOON_FAIRE,
		[CONSTANTS.ART_TEXTURES.DMF_TEROKKAR_START] = CONSTANTS.HOLIDAY_TEXTURES.DARKMOON_FAIRE,

		[CONSTANTS.ART_TEXTURES.HALLOWS_END] = CONSTANTS.HOLIDAY_TEXTURES.HALLOWS_END,
		[CONSTANTS.ART_TEXTURES.HALLOWS_ONGOING] = CONSTANTS.HOLIDAY_TEXTURES.HALLOWS_END,
		[CONSTANTS.ART_TEXTURES.HALLOWS_START] = CONSTANTS.HOLIDAY_TEXTURES.HALLOWS_END,

		[CONSTANTS.ART_TEXTURES.HARVEST_END] = CONSTANTS.HOLIDAY_TEXTURES.PILGRIMS_BOUNTY,
		[CONSTANTS.ART_TEXTURES.HARVEST_ONGOING] = CONSTANTS.HOLIDAY_TEXTURES.PILGRIMS_BOUNTY,
		[CONSTANTS.ART_TEXTURES.HARVEST_START] = CONSTANTS.HOLIDAY_TEXTURES.PILGRIMS_BOUNTY,

		[CONSTANTS.ART_TEXTURES.LOVE_END] = CONSTANTS.HOLIDAY_TEXTURES.LOVE_IS_IN_THE_AIR,
		[CONSTANTS.ART_TEXTURES.LOVE_ONGOING] = CONSTANTS.HOLIDAY_TEXTURES.LOVE_IS_IN_THE_AIR,
		[CONSTANTS.ART_TEXTURES.LOVE_START] = CONSTANTS.HOLIDAY_TEXTURES.LOVE_IS_IN_THE_AIR,

		[CONSTANTS.ART_TEXTURES.MIDSUMMER_END] = CONSTANTS.HOLIDAY_TEXTURES.MIDSUMMER_FESTIVAL,
		[CONSTANTS.ART_TEXTURES.MIDSUMMER_ONGOING] = CONSTANTS.HOLIDAY_TEXTURES.MIDSUMMER_FESTIVAL,
		[CONSTANTS.ART_TEXTURES.MIDSUMMER_START] = CONSTANTS.HOLIDAY_TEXTURES.MIDSUMMER_FESTIVAL,

		[CONSTANTS.ART_TEXTURES.NOBLEGARDEN_END] = CONSTANTS.HOLIDAY_TEXTURES.NOBLEGARDEN,
		[CONSTANTS.ART_TEXTURES.NOBLEGARDEN_ONGOING] = CONSTANTS.HOLIDAY_TEXTURES.NOBLEGARDEN,
		[CONSTANTS.ART_TEXTURES.NOBLEGARDEN_START] = CONSTANTS.HOLIDAY_TEXTURES.NOBLEGARDEN,

		[CONSTANTS.ART_TEXTURES.WINTERVEIL_END] = CONSTANTS.HOLIDAY_TEXTURES.WINTERS_VEIL,
		[CONSTANTS.ART_TEXTURES.WINTERVEIL_IEND] = CONSTANTS.HOLIDAY_TEXTURES.WINTERS_VEIL,
		[CONSTANTS.ART_TEXTURES.WINTERVEIL_ONGOING] = CONSTANTS.HOLIDAY_TEXTURES.WINTERS_VEIL,
		[CONSTANTS.ART_TEXTURES.WINTERVEIL_START] = CONSTANTS.HOLIDAY_TEXTURES.WINTERS_VEIL,
	},
}

function HolidayEvents.IsItemAvailableToday(item)
	if not item.holidayTexture then
		return true
	end

	for artTextureID, _ in pairs(Rarity.holiday_textures) do
		local legacyTextureIconPath = HolidayEvents.fileDataTexturesToLegacyIconPath[artTextureID]
		local isRequiredHolidayEventActive = (legacyTextureIconPath == item.holidayTexture)
		if isRequiredHolidayEventActive then
			return true
		end
	end

	return false
end

Rarity.HolidayEvents = HolidayEvents
return HolidayEvents
