local C=require(script.Parent.Symbol)local J={}function J.new(t,O)local m=C.new(t)local h={}for J,t in ipairs(O)do h[t]=C.new(t,m)end local g=setmetatable({_scope=m},{__index=function(C,O)if h[O]then return h[O]elseif J[O]then return J[O]else error("\085\110\107\110\111\119\110 "..(t..("\058 "..tostring(O))),2)end end,__newindex=function()error("\067\097\110\110\111\116 \097\100\100 \110\101\119 "..t,2)end})return g end function J.Is(t,J)return C.IsInScope(J,t._scope)end return J
--[[

	enumList = EnumList.new(name: string, enums: string[])

	enumList:Is(item)


	Example:

		direction = EnumList.new("Direction", {"Up", "Down", "Left", "Right"})
		leftDir = direction.Left
		print("IsDirection", direction:Is(leftDir))

--]]

local Symbol = require(script.Parent.Symbol)

local EnumList = {}

function EnumList.new(name, enums)
	local scope = Symbol.new(name)
	local enumItems = {}
	for _, enumName in ipairs(enums) do
		enumItems[enumName] = Symbol.new(enumName, scope)
	end
	local self = setmetatable({
		_scope = scope,
	}, {
		__index = function(_t, k)
			if enumItems[k] then
				return enumItems[k]
			elseif EnumList[k] then
				return EnumList[k]
			else
				error("Unknown " .. name .. ": " .. tostring(k), 2)
			end
		end,
		__newindex = function()
			error("Cannot add new " .. name, 2)
		end,
	})
	return self
end

function EnumList:Is(obj)
	return Symbol.IsInScope(obj, self._scope)
end

return EnumList
