package br.com.centralit.citsmart.rest.v3.schema;

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

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

import br.com.centralit.citsmart.rest.schema.CtErrorLog;
import br.com.centralit.citsmart.rest.schema.CtMessageResp;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CtErrorGetListResp")
public class CtErrorGetListResp extends CtMessageResp {

    @XmlElement(name = "Amount")
    protected int amount;

    @XmlElement(name = "Errors", required = true)
    protected List<CtErrorLog> errors;

    public int getAmount() {
        return amount = this.getErrors().size();
    }

    public void setAmount(final int amount) {
        this.amount = amount;
    }

    public List<CtErrorLog> getErrors() {
        if (errors == null) {
        	errors = new ArrayList<>();
        }
        return errors;
    }

}
