local z=game:GetService("\084\101\097\109\115")local s=require(script.Parent.Parent.Shared.Util)local B={Transform=function(B)local o=s.MakeFuzzyFinder(z:GetTeams())return o(B)end,Validate=function(z)return#z>0,"\078\111 \116\101\097\109 \119\105\116\104 \116\104\097\116 \110\097\109\101 \099\111\117\108\100 \098\101 \102\111\117\110\100\046"end,Autocomplete=function(z)return s.GetNames(z)end,Parse=function(z)return z[1]end}local o={Listable=true,Transform=B.Transform,Validate=B.Validate,Autocomplete=B.Autocomplete,Parse=function(z)return z[1]:GetPlayers()end}local X={Transform=B.Transform;Validate=B.Validate,Autocomplete=B.Autocomplete,Parse=function(z)return z[1].TeamColor end}return function(z)z:RegisterType("\116\101\097\109",B)z:RegisterType("\116\101\097\109\115",s.MakeListableType(B))z:RegisterType("\116\101\097\109\080\108\097\121\101\114\115",o)z:RegisterType("\116\101\097\109\067\111\108\111\114",X)z:RegisterType("\116\101\097\109\067\111\108\111\114\115",s.MakeListableType(X))end
local Teams = game:GetService("Teams")
local Util = require(script.Parent.Parent.Shared.Util)

local teamType = {
	Transform = function(text)
		local findTeam = Util.MakeFuzzyFinder(Teams:GetTeams())

		return findTeam(text)
	end,

	Validate = function(teams)
		return #teams > 0, "No team with that name could be found."
	end,

	Autocomplete = function(teams)
		return Util.GetNames(teams)
	end,

	Parse = function(teams)
		return teams[1]
	end,
}

local teamPlayersType = {
	Listable = true,
	Transform = teamType.Transform,
	Validate = teamType.Validate,
	Autocomplete = teamType.Autocomplete,

	Parse = function(teams)
		return teams[1]:GetPlayers()
	end,
}

local teamColorType = {
	Transform = teamType.Transform,
	Validate = teamType.Validate,
	Autocomplete = teamType.Autocomplete,

	Parse = function(teams)
		return teams[1].TeamColor
	end,
}

return function(cmdr)
	cmdr:RegisterType("team", teamType)
	cmdr:RegisterType("teams", Util.MakeListableType(teamType))

	cmdr:RegisterType("teamPlayers", teamPlayersType)

	cmdr:RegisterType("teamColor", teamColorType)
	cmdr:RegisterType("teamColors", Util.MakeListableType(teamColorType))
end
