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

LriDiagnosticLogProvider.lua

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

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

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

local Rx = require 'Rx'

local KSLuaUtils = require "KSLuaUtils"
local WFDiagnosticLog = require 'WFDiagnosticLog'
local _, LrmNativeApp = KSLuaUtils.requireIfExists( 'LrmNativeApp' )
local WFRxNativeObservable = require 'WFRxNativeObservable'
local WFCloseSupport = require 'WFCloseSupport'
local WFArguments = require 'WFArguments'

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

local diagnosticLogProviderMethods = {

	_name = false,
	
	WFCloseSupport.addCloseSupportMethods,
}

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

function diagnosticLogProviderMethods:__init( name )

	WFArguments.check( 'LriDiagnosticLogProvider', 'string' )
	
	self._name = name
	
	WFDiagnosticLog.addLogProvider( self )
	
end

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

function diagnosticLogProviderMethods:sendDiagnosticLogData()

	return {

		name = self._name,
		id = self._name,
		weight = 100,

		body = {
			v = WFRxNativeObservable( LrmNativeApp.sendDiagnosticLog, self._name )
		}
	}
	
end

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

return Rx.Class 'LriDiagnosticLogProvider'( diagnosticLogProviderMethods )
