package org.bench4q.agent.scenario.dfa;

public class ParamPart {
	public static enum ParamPartType {
		STRING, SESSION_ID, CONTEXT_CALL, PROPERTY
	}

	private ParamPartType type;
	private String contentForStringType;
	private String pluginIdForContextCallType;
	private String variableForContextCallAndProperty;

	public ParamPartType getType() {
		return type;
	}

	public void setType(ParamPartType type) {
		this.type = type;
	}

	public String getContentForStringType() {
		return contentForStringType;
	}

	public void setContentForStringType(String contentForStringType) {
		this.contentForStringType = contentForStringType;
	}

	public String getPluginIdForContextCallType() {
		return pluginIdForContextCallType;
	}

	public void setPluginIdForContextCallType(String pluginIdForContextCallType) {
		this.pluginIdForContextCallType = pluginIdForContextCallType;
	}

	public String getVariableForContextCallAndProperty() {
		return variableForContextCallAndProperty;
	}

	public void setVariableForContextCallAndProperty(
			String variableForContextCallAndProperty) {
		this.variableForContextCallAndProperty = variableForContextCallAndProperty;
	}

	public ParamPart() {
	}

	public ParamPart(ParamPartType type, String contentForStringType,
			String pluginIdForContextCallType,
			String variableForContextCallAndProperty) {
		this.setType(type);
		this.setContentForStringType(contentForStringType);
		this.setPluginIdForContextCallType(pluginIdForContextCallType);
		this.setVariableForContextCallAndProperty(variableForContextCallAndProperty);
	}

	@Override
	public String toString() {
		switch (type) {
		case STRING:
			return this.contentForStringType;
		case SESSION_ID:
			return "$#";
		case CONTEXT_CALL:
			return "${" + this.pluginIdForContextCallType + ":"
					+ this.variableForContextCallAndProperty + "}";
		case PROPERTY:
			return "${" + this.variableForContextCallAndProperty + "}";
		default:
			return "Plug-in parameter part " + this.contentForStringType + "/"
					+ this.pluginIdForContextCallType + "/"
					+ this.variableForContextCallAndProperty
					+ " has an unspecified type " + type.toString();
		}
	}
}
