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

ADOBE CONFIDENTIAL
------------------
Copyright 2015 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.

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

	-- WF.core.models
local WFModelsUtils = require 'WFModelsUtils'
local WFPlatformInfo = require 'WFPlatformInfo'

	-- WF.lrmobile
local LrmAlbumModel = require 'LrmAlbumModel'
local LrmAllPhotosAlbumModel = require 'LrmAllPhotosAlbumModel'
local LrmSocialActivityFeedModel = require 'LrmSocialActivityFeedModel'
local LrmSocialActivityStatusModel = require 'LrmSocialActivityStatusModel'

local LrmLibraryModelUtils = require 'LrmLibraryModelUtils'

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

local LrmLibraryModelFactory = {}

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


local makeSubmodelFactoryFn = LrmLibraryModelUtils.makeSubmodelFactoryFn
local makeSubmodelWithWFCatalogFactoryFn = LrmLibraryModelUtils.makeSubmodelWithWFCatalogFactoryFn

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

local function makeSubmodels()

	local LrmLibraryModel = {}

	if WFPlatformInfo.isiOS then
		local LriSyncStatusModel = require "LriSyncStatusModel"
		local LriBlobConsistencyModel = require "LriBlobConsistencyModel"
		local LriP2PServiceModel = require "LriP2PServiceModel"
		local LriDevelopModel = require "LriDevelopModel"
		local LriAuxOfflineDownloaderModel = require 'LriAuxOfflineDownloaderModel'
		
		LrmLibraryModel.syncStatusModel = makeSubmodelFactoryFn( LriSyncStatusModel.makeModel )
		LrmLibraryModel.fixBlobsModel = makeSubmodelWithWFCatalogFactoryFn( LriBlobConsistencyModel.makeModel )
		LrmLibraryModel.p2pServiceModel = makeSubmodelWithWFCatalogFactoryFn( LriP2PServiceModel.makeModel )
		LrmLibraryModel.developModel = makeSubmodelFactoryFn( LriDevelopModel.makeModel )
		LrmLibraryModel.auxOfflineDownloaderModel = makeSubmodelFactoryFn( LriAuxOfflineDownloaderModel.makeModel )

	else
		local LrmDevelopModel = require "LrmDevelopModel"
		local LrmVideoDevelopModel = require "LrmVideoDevelopModel"
		local LrmExportModel = require "LrmExportModel"
		local LrmAssetMetadataModel = require "LrmAssetMetadataModel"
		local LrmAssetInfoModel = require "LrmAssetInfoModel"
		local LrmSyncStatusModel = require "LrmSyncStatusModel"

		LrmLibraryModel.developModel = makeSubmodelFactoryFn( LrmDevelopModel.makeModel )
		LrmLibraryModel.videoDevelopModel = makeSubmodelFactoryFn( LrmVideoDevelopModel.makeModel )
		LrmLibraryModel.exportModel = makeSubmodelFactoryFn( LrmExportModel.makeModel )
		LrmLibraryModel.metadataModel = makeSubmodelFactoryFn( LrmAssetMetadataModel.makeModel )
		LrmLibraryModel.assetInfoModel = makeSubmodelFactoryFn( LrmAssetInfoModel.makeModel )
		LrmLibraryModel.syncStatusModel = makeSubmodelFactoryFn( LrmSyncStatusModel.makeModel )
	end

	LrmLibraryModel.albumModel = makeSubmodelWithWFCatalogFactoryFn( LrmAlbumModel.albumModel )
	LrmLibraryModel.allPhotosAlbumModel = makeSubmodelWithWFCatalogFactoryFn( LrmAllPhotosAlbumModel.makeModel )
	LrmLibraryModel.socialActivityFeedModel = makeSubmodelWithWFCatalogFactoryFn( LrmSocialActivityFeedModel.makeSocialActivityModel )
	LrmLibraryModel.makeSocialActivityStatusModel = makeSubmodelWithWFCatalogFactoryFn( LrmSocialActivityStatusModel.makeSocialActivityStatusModel )

	return LrmLibraryModel

end

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

function LrmLibraryModelFactory.makeLibrarySubModels()

	local subModels = {}

    subModels = WFModelsUtils.aggregateModels( subModels,
	
		makeSubmodels(),
		require 'LrmLibrarySocialModelImp',
		require 'LrmLibraryAlbumModelImp',
		require 'LrmLibraryAlbumListModelImp',
		require 'LrmLibraryRenditionModelImp',
		require 'LrmLibraryReviewModelImp',
		require 'LrmLibraryAlbumAssetModelImp',
		require 'LrmLibraryAssetOrganizationModelImp',
		require 'LrmLibraryImportViaCopyModelImp',
		require 'LrmLibraryStateModelImp',
		require 'LrmLibraryImportViaReferencesModelImp',
		require 'LrmLibraryDatabaseModelImp',
		require 'LrmLibraryCacheModelImp',
		require 'LrmLibraryDelete',
		require 'LrmLibraryNotification',
		require 'LrmLibraryAlbumStatusModelImp',
		require 'LrmLibraryVersionsModelImp',
		require 'LrmLibraryWatermarkModelImp',
		require 'LrmLibraryEditDefaultsImp',
		require 'LrmSearchModelImp',
		require 'LrmUploadPriorityModelImp',
		require 'LrmOzMaintenanceModelImp',
		require 'LrmSyncInfoModelImp',
		require 'LrmLibraryVideoModelImp',
		require 'LrmLibraryAssetEditInfoImp',
		require 'LrmConfigModelImp',
		require 'LrmUtilsModelImp'
	)

    if WFPlatformInfo.isAndroid then
        subModels = WFModelsUtils.aggregateModels( subModels,
					require 'LrmLibraryExportImp',
					require 'LrmPeopleModel'
					)
    end

    return subModels
end

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

return LrmLibraryModelFactory
