
package ru.nbch.credit_tracker.entities.user_request.monitoring_request;

import jakarta.xml.bind.annotation.*;
import lombok.Getter;
import lombok.Setter;


@Setter
@Getter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
        "userId",
        "password",
        "packageName",
        "subjects"
})
@XmlRootElement(name = "MonitoringRequest")
public class MonitoringRequest {

    @XmlElement(name = "UserId", required = true)
    protected String userId;
    @XmlElement(name = "Password", required = true)
    protected String password;
    @XmlElement(name = "PackageName", required = true)
    protected String packageName;
    @XmlElement(name = "Subjects", required = true)
    protected Subjects subjects;

    public Subjects getSubjects() {
        if (subjects == null) {
            subjects = new Subjects();
        }
        return subjects;
    }

    private Subject currentSubject;

    public void createCurrentSubject() {
        currentSubject = new Subject();
    }

    public Subject getCurrentSubject() {
        return currentSubject;
    }

    public void finalizeSubject() {
        getSubjects().getSubject().add(currentSubject);
    }

}
