package org.bench4q.share.helper;

import java.util.ArrayList;
import java.util.List;

import org.bench4q.share.models.agent.ParameterModel;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.scriptrecord.BatchModel;
import org.bench4q.share.models.agent.scriptrecord.BehaviorModel;
import org.bench4q.share.models.agent.scriptrecord.PageModel;

public class RunScenarioModelHelper {
	public static List<BatchModel> getBatches(
			RunScenarioModel runScenarioModelNew) {
		List<BatchModel> result = new ArrayList<BatchModel>();
		for (PageModel page : runScenarioModelNew.getPages()) {
			result.addAll(page.getBatches());
		}
		return result;
	}

	public static BehaviorModel createUserBehaviorModel(int id, String use,
			String name, List<ParameterModel> parameterModels) {
		return BehaviorModel.UserBehaviorBuilder(id, name, use,
				parameterModels);
	}

	public static ParameterModel createParameterModel(String key, String value) {
		ParameterModel parameterModel = new ParameterModel();
		parameterModel.setKey(key);
		parameterModel.setValue(value);
		return parameterModel;
	}
}
