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

WFLocalDocUtils.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 KSTableUtils = require 'KSTableUtils'

local WFArguments_check = WFArguments.check

local KSTableUtils_derefOpt = KSTableUtils.derefOpt

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

local function currentRevIdIsOnOz( docValue )

	WFArguments_check( 'table' )

	local revId = docValue._revId

	if not revId then

		return false

	end

	local ozRevIds = 
			KSTableUtils_derefOpt( docValue, "_serverProvidedMetadata", 
									"revision_ids" )

	if type( ozRevIds ) ~= "table" then

		return false

	end

	for i = #ozRevIds, 1, -1 do

		if ozRevIds[ i ] == revId then

			return true

		end

	end

	return false

end

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

return {

	currentRevIdIsOnOz = currentRevIdIsOnOz,

}
