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

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

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

	-- WF.core.utils
local WFLogger = require "WFLogger"

	-- WF.oz_client.manged_catalog
local WFCatAssetAux = require 'WFCatAssetAux'

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

local logger = WFLogger( 'LriAuxOfflineDownloaderModel' )

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

local LriAuxOfflineDownloaderModel = {}

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

function LriAuxOfflineDownloaderModel.makeModel( ozCatalogService, assetIds, optImageType )

	logger:infof( "Now downloading auxiliaries for assets %s", assetIds )

	local value = ozCatalogService._wfCatalogStream

		:take( 1 )

		:flatMap( function( wfCatalog )
			return WFCatAssetAux.bulkDownloadAuxiliariesForOfflineUse( wfCatalog, assetIds, optImageType )
		end )

	return {

		value = value

	}

end

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

return LriAuxOfflineDownloaderModel
