--[[----------------------------------------------------------------------------

WFArguments_uuid.lua

--------------------------------------------------------------------------------

ADOBE CONFIDENTIAL
------------------
Copyright 2012 Adobe Systems Incorporated
All Rights Reserved.

NOTICE: All information contained herein is, and remain the property of
Adobe Systems Incorporated and its suppliers, if any. The intellectual and
technical concepts contained herein are proprietary to Adobe Systems
Incorporated and its suppliers and may be covered by U.S. and Foreign
Patents, patents in process, and are protected by trade secret or copyright
law.  Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

------------------------------------------------------------------------------]]

	-- wichitafoundation.core.utils
local WFArguments = require 'WFArguments'

local type = type
local string_match = string.match

--============================================================================--
--[[!
	\brief This namespace provides a type checker for the compact UUIDs used
		throughout Revel and Oz's data model.

		You should never have to call the type-check function directly.
		You must, however, require this namespace, so that the type checker
		is registered correctly.

	
	\sa WFArguments
]]--

-- @mark WFArguments_uuid namespace

local WFArguments_uuid = {}

--------------------------------------------------------------------------------
--[[!
	\brief Verifies that the argument is a compact UUID.
	
	\param arg The argument to verify.
	
	\return (boolean) \c true if the argument is a compact UUID, \c false if not
]]--

function WFArguments_uuid.isUuid( --[[any type]] arg )

	return not not ( type( arg ) == 'string'
		and #arg == 32
		and string_match( arg, '^[0-9a-f]+$' ) )
	
end

WFArguments.registerChecker( 'uuid', WFArguments_uuid.isUuid )

--------------------------------------------------------------------------------

return WFArguments_uuid
