package hr.com.port.ips.eracun.modeli;

import java.sql.Date;
import java.sql.Timestamp;

// korisno ako želiš raditi s enumima direktno:
import hr.com.port.ips.eracun.provider.mer.enums.MerEreportingInvoiceType;
import hr.com.port.ips.eracun.provider.mer.enums.MerEreportingStatus;

public class MerEreporting {

    private Long id;

    // poslovni ključ
    private Integer vrstaDokumenta; // dokumenti_vrste.id
    private Integer godina;
    private Integer opp;
    private Integer onu;
    private Integer broj;

    // parametri eReporting poziva
    private Date deliveryDate;
    private Boolean isCopy;
    private String invoiceTypeCode; // "U" | "I" | "IR"

    // status i xml
    private Integer statusId;       // MerEreportingStatus.getId()
    private String xmlPath;

    // audit
    private Timestamp createdAt;
    private Timestamp updatedAt;

    public MerEreporting() { }

    // --- getters/setters ---
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }

    public Integer getVrstaDokumenta() { return vrstaDokumenta; }
    public void setVrstaDokumenta(Integer vrstaDokumenta) { this.vrstaDokumenta = vrstaDokumenta; }

    public Integer getGodina() { return godina; }
    public void setGodina(Integer godina) { this.godina = godina; }

    public Integer getOpp() { return opp; }
    public void setOpp(Integer opp) { this.opp = opp; }

    public Integer getOnu() { return onu; }
    public void setOnu(Integer onu) { this.onu = onu; }

    public Integer getBroj() { return broj; }
    public void setBroj(Integer broj) { this.broj = broj; }

    public Date getDeliveryDate() { return deliveryDate; }
    public void setDeliveryDate(Date deliveryDate) { this.deliveryDate = deliveryDate; }

    public Boolean getIsCopy() { return isCopy; }
    public void setIsCopy(Boolean isCopy) { this.isCopy = isCopy; }

    public String getInvoiceTypeCode() { return invoiceTypeCode; }
    public void setInvoiceTypeCode(String invoiceTypeCode) { this.invoiceTypeCode = invoiceTypeCode; }

    public Integer getStatusId() { return statusId; }
    public void setStatusId(Integer statusId) { this.statusId = statusId; }

    public String getXmlPath() { return xmlPath; }
    public void setXmlPath(String xmlPath) { this.xmlPath = xmlPath; }

    public Timestamp getCreatedAt() { return createdAt; }
    public void setCreatedAt(Timestamp createdAt) { this.createdAt = createdAt; }

    public Timestamp getUpdatedAt() { return updatedAt; }
    public void setUpdatedAt(Timestamp updatedAt) { this.updatedAt = updatedAt; }

    // --- helperi za enum-e (opcionalno, ali praktično) ---
    public MerEreportingInvoiceType getInvoiceTypeEnum() {
        return MerEreportingInvoiceType.fromCode(invoiceTypeCode);
    }
    public void setInvoiceTypeEnum(MerEreportingInvoiceType t) {
        this.invoiceTypeCode = (t != null ? t.getCode() : null);
    }

    public MerEreportingStatus getStatusEnum() {
        return MerEreportingStatus.fromId(statusId);
    }
    public void setStatusEnum(MerEreportingStatus s) {
        this.statusId = (s != null ? s.getId() : null);
    }
}
