local CombuctorSet = Combuctor:GetModule("Sets")

-- Profession Icon Name
local IconPathName="Interface/Icons/Trade_Mining"

-- Tab Names
local TN={}
TN.All=ALL
TN.MetalStone="Mining"; 

SubClass_MetalStone				=select(4, GetAuctionItemSubClasses(6));

function TN.isMetalStone(player, bagType, name, link, quality, level, ilvl, type, subType, stackCount, equipLoc)
	return TN.isOre(player, bagType, name, link, quality, level, ilvl, type, subType, stackCount, equipLoc)
		or TN.isBar(player, bagType, name, link, quality, level, ilvl, type, subType, stackCount, equipLoc)
	    or TN.isStone(player, bagType, name, link, quality, level, ilvl, type, subType, stackCount, equipLoc);
end

function TN.isOre(player, bagType, name, link, quality, level, ilvl, type, subType, stackCount, equipLoc)
	if not subType then return false end
	
	return string.find(name, "Ore") ~= nil and subType==SubClass_MetalStone;
end

function TN.isBar(player, bagType, name, link, quality, level, ilvl, type, subType, stackCount, equipLoc)
	if not subType then return false end
	
	if subType ~= SubClass_MetalStone then return false; end;

	return string.find(name, "Bar") or name == "Truegold";
end

function TN.isStone(player, bagType, name, link, quality, level, ilvl, type, subType, stackCount, equipLoc)
	if not subType then return false end

	return string.find(name, "Stone") and subType==SubClass_MetalStone;
end

CombuctorSet:Register(TN.MetalStone, IconPathName, TN.isMetalStone)

CombuctorSet:RegisterSubSet(TN.All,		TN.MetalStone,nil,TN.isMetalStone)
CombuctorSet:RegisterSubSet("Ores",		TN.MetalStone,nil,TN.isOre)
CombuctorSet:RegisterSubSet("Bars",		TN.MetalStone,nil,TN.isBar)
CombuctorSet:RegisterSubSet("Stones",	TN.MetalStone,nil,TN.isStone)
