package org.bench4q.share.models.master.statistics;

import java.util.Date;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class ScriptResultModel extends SampleModel {

	private ScriptBriefResultModel scriptBriefResultModel;
	private ScriptBehaviorsBriefModel scriptBehaviorsBriefModel;
	private ScriptPagesBriefModel scriptPagesBriefModel;

	@XmlElement
	public ScriptBriefResultModel getScriptBriefResultModel() {
		return scriptBriefResultModel;
	}

	public void setScriptBriefResultModel(
			ScriptBriefResultModel scriptBriefResultModel) {
		this.scriptBriefResultModel = scriptBriefResultModel;
	}

	@XmlElement
	public ScriptBehaviorsBriefModel getScriptBehaviorsBriefModel() {
		return scriptBehaviorsBriefModel;
	}

	public void setScriptBehaviorsBriefModel(
			ScriptBehaviorsBriefModel scriptBehaviorsBriefModel) {
		this.scriptBehaviorsBriefModel = scriptBehaviorsBriefModel;
	}

	@XmlElement
	public ScriptPagesBriefModel getScriptPagesBriefModel() {
		return scriptPagesBriefModel;
	}

	public void setScriptPagesBriefModel(
			ScriptPagesBriefModel scriptPagesBriefModel) {
		this.scriptPagesBriefModel = scriptPagesBriefModel;
	}

	public static ScriptResultModel buildFinishedResult() {
		ScriptResultModel result = new ScriptResultModel();
		result.setScriptBehaviorsBriefModel(buildFinishedBehaviors());
		result.setScriptBriefResultModel(buildFinishedScenario());
		result.setScriptPagesBriefModel(buildFinishedPages());
		return result;
	}

	private static ScriptPagesBriefModel buildFinishedPages() {
		ScriptPagesBriefModel result = new ScriptPagesBriefModel();
		result.setSamplingTime(new Date());
		result.setFinished(true);
		return result;
	}

	private static ScriptBriefResultModel buildFinishedScenario() {
		ScriptBriefResultModel result = new ScriptBriefResultModel();
		result.setSamplingTime(new Date());
		result.setFinished(true);
		return result;
	}

	private static ScriptBehaviorsBriefModel buildFinishedBehaviors() {
		ScriptBehaviorsBriefModel result = new ScriptBehaviorsBriefModel();
		result.setSamplingTime(new Date());
		result.setFinished(true);
		return result;
	}
}
