package ru.nbch.credit_tracker.entities.user_response.monitoring_signal_response;

import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;

import java.util.ArrayList;
import java.util.List;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
        "signals"
})
public class Signals {

    @XmlElement(name = "Signal", required = true)
    protected List<Signal> signals;

    public List<Signal> getSignals() {
        if (signals == null) {
            signals = new ArrayList<>();
        }
        return this.signals;
    }

    private Signal currentSignal;

    public void createCurrentSignal() {
        currentSignal = new Signal();
    }

    public Signal getCurrentSignal() {
        return currentSignal;
    }

    public void finalizeSignal() {
        getSignals().add(currentSignal);
    }
}
