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

/**
 * Data model for an audio event. Audio events have a filepath leading to an
 * audio file to be played, and a length in seconds of that file.
 *
 * @author Bryan McGuffin
 */
public class AudioEvent extends ScriptEvent implements I_XML_Writable
{

    public AudioEvent()
    {
        super(ScriptEventType.AUDIO_EVENT);
    }

    public Integer audioLength = 0;

    public String audioPath = "";

    @Override
    public String toXML()
    {
        return emptyTag(ELEMENT.AUDIO.tag + " Length=\"" + audioLength + "\" Path=\"" + audioPath + "\"");
    }

    @Override
    public String openTag(String s)
    {
        return "<" + s + ">";
    }

    @Override
    public String closeTag(String s)
    {
        return "</" + s + ">\n";
    }

    @Override
    public String emptyTag(String s)
    {
        return "<" + s + "/>\n";
    }
}
