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

WFCatExportHeicProvider.lua

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

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

----------------------------------------------------------------------------]]--
	-- RxLua
local Rx = require 'Rx'
local Observable = Rx.Observable

	-- WF.acr
local WFCrInfo = require 'WFCrInfo'	

	-- WF.core.logging
local WFLogger = require 'WFLogger'

local logger = WFLogger 'WFCatExportHeicProvider'

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

-- @mark WFCatExportHeicProvider
--------------------------------------------------------------------------------

local WFCatExportHeicProvider = {
	_fallbackExportProvider = false,
		-- If HEIC is supported, use this provider
}

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

function WFCatExportHeicProvider:__init( fallbackProvider )
	assert( fallbackProvider )
	self._fallbackExportProvider = fallbackProvider
end

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

function WFCatExportHeicProvider:exportAsset( request, wfCatalog, exportPixelProviderTask, maybeProfileDownloaderTask )
	
	if not WFCrInfo.supportsHeic() then
		logger:warnf( "Ignoring request %s", request.id )
		
		return Observable.throw( 'heic_unsupported_platform' )
	end
	
	return self._fallbackExportProvider:exportAsset( request, wfCatalog, exportPixelProviderTask, maybeProfileDownloaderTask )
end

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

return Rx.Class 'WFCatExportHeicProvider'( WFCatExportHeicProvider )
