-- Public Methods


function TextMaskClass:GetValue()
	return self._MaskType:ToType(self.Frame.Text)
end

function TextMaskClass:GetMaskType()
	return self._MaskType.Name
end

function TextMaskClass:SetMaxLength(len)
	self._MaxLength = len
end

function TextMaskClass:SetMaskType(name)
	local mask = MASKS[name]
	if (not mask) then
		mask = MASKS.String
		warn(WARN_MSG:format(name))
	end
	self._MaskType = mask
	self.Frame.Text = mask:Process(self.Frame.Text):sub(1, self._MaxLength)
	
	-- Add increment/decrement buttons for numeric inputs
	if name == "Number" then
		-- Initialize text to 0, consumer can override
		self.Frame.Text = 0

		self.IncrementButton = INCREMENT_BUTTON:Clone()
		self.IncrementButton.AnchorPoint = Vector2.new(1, 0)
		self.IncrementButton.Position = UDim2.new(1, 0, 0, 0)
		self._Maid:Mark(self.IncrementButton.Activated:Connect(function()
			self.Frame.Text = tonumber(self.Frame.Text) + 1
		end))
		self.IncrementButton.Parent = self.Frame
		self._Maid:Mark(self.IncrementButton)
		
		self.DecrementButton = DECREMENT_BUTTON:Clone()
		self.DecrementButton.AnchorPoint = Vector2.new(1, 1)
		self.DecrementButton.Position = UDim2.new(1, 0, 1, 0)
		self._Maid:Mark(self.DecrementButton.Activated:Connect(function()
			self.Frame.Text = tonumber(self.Frame.Text) - 1
		end))
		self.DecrementButton.Parent = self.Frame
		self._Maid:Mark(self.DecrementButton)
	end
end

function TextMaskClass:Destroy()
	self._Maid:Sweep()
end
