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

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

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

@Setter
@Getter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
        "inquiries"
})
public class Person {

    @XmlAttribute(name = "uid", required = true)
    protected Integer uid;

    @XmlElement(name = "Inquiry", required = true)
    protected List<Inquiry> inquiries;

    public List<Inquiry> getInquiries() {
        if (inquiries == null) {
            inquiries = new ArrayList<>();
        }
        return this.inquiries;
    }

    private Inquiry currentInquiry;

    public void createCurrentInquiry() {
        currentInquiry = new Inquiry();
    }

    public Inquiry getCurrentInquiry() {
        return currentInquiry;
    }

    public void finalizeInquiry() {
        getInquiries().add(currentInquiry);
    }
}
