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

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 WFCapabilities = require 'WFCapabilities'
local WFPlatformInfo = require 'WFPlatformInfo'

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

local LrmWFCapabilities = {}

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

local lrmCapabilities

if WFPlatformInfo.isiOS then
	lrmCapabilities = {
		{ "WFOzRenditionServerUtils.ozLinkNameForRenditionName", "LrMobile", "LrmWFCapabilities.ozLinkNameForRenditionName" },
		{ "OzCatalogService.defaultProxyType", "LrMobile", "LrmWFCapabilities.defaultProxyType" },
		{ "WFOzRenditionServer.thumbnailCacheSequence", "LrMobile", "LrmWFCapabilities.thumbnailBCache2" },
		{ "WFOzRenditionServer.thumbnailCacheSize", "LrMobile", "LrmWFCapabilities.thumbnailCacheSize" },
		{ "OzUser.catalogListingSubtype", "LrMobile", "LrmWFCapabilities.catalogListingSubtype" },
		{ "BabluImp.purgeAgentManagerClass", "LrMobile", "LrmWFCapabilities.newPurgeAgentManagerClass" },
		{ "WFOzCatalogIndexDefinitions.tableDefinitions", "LrMobile", "LrmCatalogIndexDefinitions.tableDefinitions" },
		{ "WFOzCatalogIndexDefinitions.indexDefinitions", "LrMobile", "LrmCatalogIndexDefinitions.indexDefinitions" },
		{ "OzCatalogIndexDefinitions.tableDefinitions", "LrMobile", "LrmCatalogIndexDefinitions.tableDefinitions" },
		{ "OzCatalogIndexDefinitions.indexDefinitions", "LrMobile", "LrmCatalogIndexDefinitions.indexDefinitions" },
	}
else 
	lrmCapabilities = {
		{ "WFOzRenditionServerUtils.ozLinkNameForRenditionName", "LrMobile", "LrmWFCapabilities.ozLinkNameForRenditionName" },
		{ "OzCatalogService.defaultProxyType", "LrMobile", "LrmWFCapabilities.defaultProxyType" },
		{ "WFOzRenditionServer.thumbnailCacheSequence", "LrMobile", "LrmWFCapabilities.thumbnailBCache2" },
		{ "WFOzRenditionServer.thumbnailCacheSize", "LrMobile", "LrmWFCapabilities.thumbnailCacheSize" },
		{ "OzUser.catalogListingSubtype", "LrMobile", "LrmWFCapabilities.catalogListingSubtype" },
		{ "BabluImp.purgeAgentManagerClass", "LrMobile", "LrmWFCapabilities.newPurgeAgentManagerClass" },
		{ "WFOzCatalogIndexDefinitions.tableDefinitions", "LrMobile", "LrmCatalogIndexDefinitions.tableDefinitions" },
		{ "WFOzCatalogIndexDefinitions.indexDefinitions", "LrMobile", "LrmCatalogIndexDefinitions.indexDefinitions" },
		{ "OzCatalogIndexDefinitions.tableDefinitions", "LrMobile", "LrmCatalogIndexDefinitions.tableDefinitions" },
		{ "OzCatalogIndexDefinitions.indexDefinitions", "LrMobile", "LrmCatalogIndexDefinitions.indexDefinitions" },
	}
end

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

LrmWFCapabilities.ozLinkNameForRenditionNameTable = {
		thumbnail = "/rels/rendition_type/144h",
		preview = "/rels/rendition_type/2048",
		master = "/rels/master",
		thumbnail2x = "/rels/rendition_type/thumbnail2x",
	}

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

function LrmWFCapabilities.installFilters()

	for k, v in ipairs( lrmCapabilities ) do
	
		WFCapabilities.addFilter( unpack( v ) )
		
	end
	
end

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

function LrmWFCapabilities.removeFilters()

	for k, v in ipairs( lrmCapabilities ) do
	
		WFCapabilities.addFilter( v[ 1 ], v[ 2 ] )
		
	end
	
end

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

function LrmWFCapabilities.ozLinkNameForRenditionName( ozLinkNameForRenditionName )

	return LrmWFCapabilities.ozLinkNameForRenditionNameTable
	
end

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

function LrmWFCapabilities.defaultProxyType( defaultProxyType )
	return "2560"
end

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

function LrmWFCapabilities.thumbnailBCache2( thumbnailBCache2 )
	return { 'thumbnail2x', sequential = false }
end

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

function LrmWFCapabilities.thumbnailCacheSize( thumbnailCacheSize )
	return 3
end

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

function LrmWFCapabilities.catalogListingSubtype( subtype )
	return 'X-lightroom;lightroom'
end

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

function LrmWFCapabilities.newPurgeAgentManagerClass( defaultClass )
	return 'LrmOzPurgeAgentManager'
end

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

function LrmWFCapabilities.renditionNameMapping( renditionNameMapping )

	renditionNameMapping[ "1024" ] = 'preview'
	renditionNameMapping[ "2048" ] = 'preview'
	renditionNameMapping[ "master" ] = 'original'
	
	return renditionNameMapping
	
end

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

return LrmWFCapabilities
