--[[
	Given a [AssetType], this function will match it to its equivalent
	[AccessoryType].

	```lua
	matchAssetTypeToAccessoryType(Enum.AssetType.FaceAccessory) -- Enum.AccessoryType.Face
	matchAssetTypeToAccessoryType(Enum.AssetType.Hat) -- Enum.AccessoryType.Hat
	matchAssetTypeToAccessoryType(Enum.AssetType.WaistAccessory) -- Enum.AccessoryType.Waist
	```


	This function is called when we'd like to convert a given Enum.AssetType into its corresponding Enum.AccessoryType.

	@within Modules
	@return Enum.AccessoryType The AccessoryType that matches `assetType`, otherwise returns [Enum.AccessoryType.Unknown].
]]


local function matchAssetTypeToAccessoryType(assetType: Enum.AssetType): Enum.AccessoryType
	if not assetType or not assetType.Name then
		return Enum.AccessoryType.Unknown
	end

	for _, accessoryType in ipairs(Enum.AccessoryType:GetEnumItems()) do
		if string.gsub(assetType.Name, "Accessory", "") == accessoryType.Name then
			return accessoryType
		end
	end

	return Enum.AccessoryType.Unknown
end

return matchAssetTypeToAccessoryType
