#include "EdgeFill.hpp"
#include "Scanner.hpp"
#include <ES2Command/ES2CommandAPI.h>


namespace epsonscan {

void EdgeFill::SetValue(const SDIInt& intVal)
{
	SDICapability cap;
	GetCapability(cap);
	if (cap.supportLevel != kSDISupportLevelNone)
	{		
		current_ = intVal;
	}
}	
void EdgeFill::Reset()
{
	current_ = 0;
}

void EdgeFill::GetValue(SDIInt& intVal)
{
	intVal = current_;
}

void EdgeFill::GetCapability(SDICapability &capability)
{
	SetDefaultListCapability(capability);
	capability.supportLevel = kSDISupportLevelNone;

	AddList(capability, kSDIEdgeFillNone);
	AddList(capability, kSDIEdgeFillWhite);
	AddList(capability, kSDIEdgeFillBlack);

	AddAllList(capability, kSDIEdgeFillNone);
	AddAllList(capability, kSDIEdgeFillWhite);
	AddAllList(capability, kSDIEdgeFillBlack);

	capability.supportLevel = kSDISupportLevelAvailable;
}

ESDictionary EdgeFill::GetEngineKeyValues()
{
	auto dict =  ESDictionary();
	return dict;
}

bool EdgeFill::IsProcessEdgeFill()
{
	bool shouldProcessRmovePunchHole = false;
	SDICapability deficiencyCap = {0};
	GetCapabilityWithKey(kSDIEdgeFillKey, deficiencyCap);

	if (deficiencyCap.supportLevel != kSDISupportLevelNone &&  GetValueInt(kSDIRemovePunchholeKey) )
	{
		shouldProcessRmovePunchHole = true;
	}

	return GetValueInt(kSDIEdgeFillKey) || shouldProcessRmovePunchHole;
}

	
}//namespace epsonscan
