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

WFOzAssetInfo.lua

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

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

NOTICE: All information contained herein is, and remains 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 are protected by all applicable
intellectual property laws, including trade secret and copyright laws.
Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

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

local WFArguments = require 'WFArguments'
local _ = require 'WFArguments_uuid'

local WFOzAssetInfoImp = require 'WFOzAssetInfoImp'

--============================================================================--

local WFOzAssetInfoImp_makeAssetInfo = WFOzAssetInfoImp.makeAssetInfo
local WFOzAssetInfoImp_makeArray = WFOzAssetInfoImp.makeArray
local WFOzAssetInfoImp_encodeQuery = WFOzAssetInfoImp.encodeQuery

-- @mark WFOzAssetInfo namespace

--[[!

\class WFOzAssetInfo

\brief This namespace provides compact data representation of core asset info.

]]--

local WFOzAssetInfo = {}

--------------------------------------------------------------------------------
--[[!
	Creates a single WFOzAssetInfo native object.

	\param assetId (GUID) The GUID of the asset.
	\param aspectRatio (number) The aspect ratio.
	\param thumbnailMD5 (optional MD5 hex string) The thumbnail MD5.  Must be a 32-char hex string.
	\param isVideo (optional BOOL) True if the asset is a video.
	\param duration (optional integer) Duration in seconds, if it is a video.

	\return (WFAssetInfo object) A native object representing the asset info.
]]--

function WFOzAssetInfo.makeAssetInfo( assetId, aspectRatio, thumbnailMD5, isVideo, duration )
	WFArguments.check( 'uuid', 'number', '?uuid', '?boolean', '?number' )
	
	return WFOzAssetInfoImp_makeAssetInfo( assetId, aspectRatio, thumbnailMD5, isVideo, duration )
end

--------------------------------------------------------------------------------
--[[!
	Creates a lua table with preallocated space for an array of a specific size.

	\param nElements (integer) Creates an array that is allocated to hold nElements

	\return (table) A table that can be filled o nElements without causing lua to reallocate
	the array storage.
]]--

function WFOzAssetInfo.makeArray( nElements )
	WFArguments.check( 'number' )
	assert( nElements > 0 and nElements == math.floor( nElements ) )
	return WFOzAssetInfoImp_makeArray( nElements )
end

--------------------------------------------------------------------------------
--[[!
	This is an encoder suitable for use by WFSQLiteDatabase.encodeResults.
	In that situation it returns a single userdata object -- a WFOzAssetInfoArray --
	which is very efficient in storage of asset info. WFOzAssetInfoArray should
	be passed to native code for use.  See WFOzAssetInfo.h

	\param The SQLite statement, as per WFSQLiteDatabase.encodeResults

	\return (WFOzAssetInfoArray) A native array of asset infos.
]]--

function WFOzAssetInfo.encodeSql( stmt )

	return WFOzAssetInfoImp_encodeQuery( stmt )

end

--==============================================================================

return WFOzAssetInfo
