package ru.nbch.credit_tracker.entities.external_response.online_download;

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 = {
        "persons"
})
public class Persons {

    @XmlElement(name = "Person", required = true)
    protected List<Person> persons;

    public List<Person> getPersons() {
        if (persons == null) {
            persons = new ArrayList<>();
        }
        return this.persons;
    }

    private Person currentPerson;

    public void createCurrentPerson() {
        currentPerson = new Person();
    }

    public Person getCurrentPerson() {
        return currentPerson;
    }

    public void finalizePerson() {
        getPersons().add(currentPerson);
    }

}
