/*
 * 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.StringTokenizer;
import scriptbuilder.structures.ELEMENT;
import scriptbuilder.structures.I_XML_Writable;
import scriptbuilder.structures.ScriptEvent;
import scriptbuilder.structures.XMLWriter;

/**
 * Data model for a CAD incident event. CAD events have a string description of
 * what is occurring at that time, and may or may not have sub-events.
 *
 * @author Bryan McGuffin
 */
public class CADEvent extends ScriptEvent implements I_XML_Writable
{

    /**
     * Constructor.
     */
    public CADEvent()
    {
        super(ScriptEventType.CAD_EVENT);
    }

    /**
     * True if this CAD event has sub-events.
     */
    public boolean hasSubEvents = false;

    /**
     * Description of this event.
     */
    public String detail = "";

    @Override
    public String toXML()
    {
        StringTokenizer tok = new StringTokenizer(detail, "\n");
        String output = "";
        while (tok.hasMoreTokens())
        {
            output += XMLWriter.simpleTag(tok.nextToken(), ELEMENT.DETAIL);
        }
        return output;
    }
}
