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

LrmLibraryVersionsModelImpTest.lua

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

ADOBE CONFIDENTIAL
------------------
Copyright 2020 Adobe
All Rights Reserved.

NOTICE: All information contained herein is, and remains
the property of Adobe and its suppliers, if any. The intellectual
and technical concepts contained herein are proprietary to Adobe
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.

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

local Rx = require "Rx"

	-- com.adobe.wichitafoundation.core.utils
local WFModelsUtils = require 'WFModelsUtils'
local WFPlatformInfo = require 'WFPlatformInfo'

-- This model test is only valid on the mobile platforms.

if not WFPlatformInfo.isMobile() then
	return {}
end

	-- WF.oz_client.managed_catalog
local WFCatVersionsTestFactory = require 'WFCatVersionsTestFactory'

local OzCatalogServiceViaWFCatalog = require 'OzCatalogServiceViaWFCatalog'

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

local function createParentModelForTest( rxTest, wfCatalog )
	
	local submodels = {}
	
	submodels = WFModelsUtils.aggregateModels( submodels, require( 'LrmLibraryVersionsModelImp' ) )

	local wfCatalogStream = Rx.Observable.just( wfCatalog )

	local ozCatalog = OzCatalogServiceViaWFCatalog( wfCatalogStream )

	return {
		_wfCatalogStream = wfCatalogStream,
		value = Rx.Observable.just( true ),
		models = submodels,
		close = function() --[[noop]] end,
		catalog = ozCatalog
	}
	
end

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

local submodelsByImplementation = {

	defaultParentModelConstructorFn = createParentModelForTest,

	[ 'WFCatVersions' ] = {
	
		[ 'getAllVersionsStreamForAsset' ] = {
		
			submodelNamespace = 'LrmLibraryVersionsModelImp',
			submodelName = 'getAllVersionsByAssetId',
			
		},
		
		[ 'getManualVersionsStreamForAsset' ] = {
		
			submodelNamespace = 'LrmLibraryVersionsModelImp',
			submodelName = 'getManualVersionsByAssetId',
			
		},
		
		[ 'getAutoVersionsStreamForAsset' ] = {
		
			submodelNamespace = 'LrmLibraryVersionsModelImp',
			submodelName = 'getAutoVersionsByAssetId',
			
		}
		
	}
	
}

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

return WFCatVersionsTestFactory( submodelsByImplementation )
