package ua.be.wee.controller;

import ua.be.wee.model.nodes.AutomatedActivity;
import ua.be.wee.model.nodes.FinalNode;
import ua.be.wee.model.nodes.ports.ControlInputPort;

public class PMTrigger {
	
	private FinalNode node;
	private ControlInputPort port;
	private String branchId;
	private String invokingActivityName; // New field to store the invoking activity's name

	public FinalNode getNode() {
		return node;
	}
	
	public void setNode(FinalNode node) {
		this.node = node;
	}

	public ControlInputPort getPort() {
		return port;
	}

	public void setPort(ControlInputPort port) {
		this.port = port;
	}

	public String getName() {
		if (port != null) {
			return (port.getActivity() instanceof AutomatedActivity ? "AUT: " + port.getActivity().getName() + " VIA PORT: " + port.getName() :  port.getActivity().getName() + " VIA PORT: " + port.getName());
		} else {
			return "END TRACE";
		}
	}
	
	public String getIri() {
		if (port != null) {
			return port.getIri();
		} else {
			return node.getIri();
		}
	}

	public String getBranchId() { 
		return branchId; 
	}
	
	public void setBranchId(String branchId) { 
		this.branchId = branchId; 
	}

	public String getInvokingActivityName() {
		return invokingActivityName;
	}

	public void setInvokingActivityName(String invokingActivityName) {
		this.invokingActivityName = invokingActivityName;
	}
}