--[[
    Returns true if the given HumanoidDescription has the item described in itemInfo equipped.
]]


local MerchBooth = script:FindFirstAncestor("MerchBooth")

local types = require(MerchBooth.types)
local isAccessory = require(MerchBooth.Modules.isAccessory)
local isClassicClothing = require(MerchBooth.Modules.isClassicClothing)

local isItemEquipped = function(description: HumanoidDescription, itemInfo: types.ItemInfo)
	if isAccessory(itemInfo.assetType) then
		for _, accessory in ipairs(description:GetAccessories(true)) do
			if accessory.AssetId == itemInfo.assetId then
				return true
			end
		end
	elseif isClassicClothing(itemInfo.assetType) then
		if
			description.GraphicTShirt == itemInfo.assetId
			or description.Shirt == itemInfo.assetId
			or description.Pants == itemInfo.assetId
		then
			return true
		end
	end

	return false
end

return isItemEquipped
