--[[
	Based on the given [UserInputType], a cooresponding enum representing the
	current device is returned.

	```lua
	getCurrentDevice(Enum.UserInputType.KeyCode) -- "Computer"
	getCurrentDevice(Enum.UserInputType.Touch) -- "Mobile"
	getCurrentDevice(Enum.UserInputType.Gamepad1) -- "Gamepad"
	```

	@within Modules
]]


local function getCurrentDevice(inputType: Enum.UserInputType)
	for group, patterns in pairs(constants.DeviceInputTypePatterns) do
		for _, pattern in ipairs(patterns) do
			if inputType.Name:match(pattern) then
				return enums.Device[group]
			end
		end
	end

	return enums.Device.Unknown
end

return getCurrentDevice
