/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package scriptbuilder.structures.events;

import java.util.ArrayList;
import scriptbuilder.structures.ELEMENT;
import scriptbuilder.structures.I_XML_Writable;
import scriptbuilder.structures.ScriptEvent;
import scriptbuilder.structures.XMLWriter;

/**
 * Data model for a facilitator evaluation event. This is an evaluation event.
 *
 * @author Bryan McGuffin
 */
public class FacilitatorEvaluationEvent extends ScriptEvent implements I_EvaluationEvent, I_XML_Writable
{

    /**
     * Constructor.
     */
    public FacilitatorEvaluationEvent()
    {
        super(ScriptEventType.FACILITATOR_EVAL_EVENT);
    }

    /**
     * A list of the expected actions held by this evaluation event.
     */
    public ArrayList<String> expectedAction = new ArrayList<String>();

    @Override
    public ArrayList<String> getExpectedActions()
    {
        return expectedAction;
    }

    @Override
    public void addAction(String act)
    {
        expectedAction.add(act);
    }

    @Override
    public void updateAction(int index, String act)
    {
        expectedAction.set(index, act);
    }

    @Override
    public void removeAction(int index)
    {
        expectedAction.remove(index);
    }

    @Override
    public String toXML()
    {
        String output = XMLWriter.openTag(ELEMENT.FACILITATOR_EVALUATION.tag);
        if (expectedAction != null)
        {
            for (String str : expectedAction)
            {
                if (str == null)
                {
                    str = "";
                }
                output += XMLWriter.simpleTag(str, ELEMENT.EXPECTED_ACTION);
            }
        }
        output += XMLWriter.closeTag(ELEMENT.FACILITATOR_EVALUATION.tag);

        return output;
    }
}
