package com.eviware.soapui.model.security;

import javax.swing.JComponent;

import org.apache.xmlbeans.XmlObject;

import com.eviware.soapui.config.SecurityScanConfig;
import com.eviware.soapui.model.ModelItem;
import com.eviware.soapui.model.testsuite.Assertable;
import com.eviware.soapui.model.testsuite.TestStep;
import com.eviware.soapui.security.ExecutionStrategyHolder;
import com.eviware.soapui.security.SecurityTestRunContext;
import com.eviware.soapui.security.SecurityTestRunner;
import com.eviware.soapui.security.result.SecurityScanResult;

public interface SecurityScan extends ModelItem, Assertable
{

	public static final String SECURITY_SCAN_REQUEST_RESULT = "SecurityScanRequestResult";
	public static final String SECURITY_CHECK_RESPONSE_RESULT = "SecurityScanResponseResult";
	public static final String STATUS_PROPERTY = SecurityScan.class.getName() + "@status";

	void updateSecurityConfig( SecurityScanConfig config );

	SecurityScanResult run( TestStep testStep, SecurityTestRunContext context, SecurityTestRunner securityTestRunner );

	boolean isConfigurable();

	/**
	 * Gets desktop configuration for specific SecurityCheck
	 * 
	 * @param TestStep
	 *           the TestStep to create the config for, could be null for
	 *           HttpMonitor checks
	 * 
	 * @return
	 */
	JComponent getComponent();

	/**
	 * The type of this check
	 * 
	 * @return
	 */
	String getType();

	TestStep getTestStep();

	void setTestStep( TestStep step );

	// Object runTearDownScript( SecurityTestRunner runner,
	// SecurityTestRunContext context ) throws Exception;
	//
	// Object runSetupScript( SecurityTestRunner runner, SecurityTestRunContext
	// context ) throws Exception;

	/**
	 * Checks if the test is disabled
	 * 
	 * @return true if disabled
	 */
	boolean isDisabled();

	/**
	 * Disables or Enables the check
	 * 
	 * @param disabled
	 */
	void setDisabled( boolean disabled );

	ExecutionStrategyHolder getExecutionStrategy();

	void setExecutionStrategy( ExecutionStrategyHolder executionStrategyHolder );

	// String getSetupScript();
	//
	// void setSetupScript( String text );
	//
	// String getTearDownScript();
	//
	// void setTearDownScript( String text );

	// name used in configuration panel
	String getConfigName();

	// description usd in configuration panel
	String getConfigDescription();

	// help url used for configuration panel ( help for this check )
	String getHelpURL();

	/**
	 * Advanced setting panel for configuration
	 * 
	 * @return
	 */
	JComponent getAdvancedSettingsPanel();

	public SecurityScanResult getSecurityScanResult();

	XmlObject getConfig();

	void copyConfig( SecurityScanConfig backupCheckConfig );

	void addWsdlAssertion( String assertionLabel );

	boolean isApplyForFailedStep();

	void setApplyForFailedTestStep( boolean apply );

	boolean isRunOnlyOnce();

	void setRunOnlyOnce( boolean runOnlyOnce );

	/*
	 * indicates in case of runOnlyOnce set if the scan was already run that once
	 */
	boolean isSkipFurtherRunning();

	void setSkipFurtherRunning( boolean skipFurtherRunning );

	void release();
}