package it.integry.integrywmsnative.core.data_store.db.entity;

import androidx.annotation.Nullable;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

import java.util.Date;

import it.integry.integrywmsnative.core.utility.UtilityDate;

@Entity(tableName = "ordini")

public class Ordine {

    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "ordine_id")
    private int ordineId;

    @ColumnInfo(name = "data_ins")
    private Date dataIns;

    @ColumnInfo(name = "annotazioni")
    private String annotazioni;

    @ColumnInfo(name = "transmitted")
    private boolean transmitted = false;

    @ColumnInfo(name = "transmission_date")
    @Nullable
    private Date transmissionDate;

    @ColumnInfo(name = "gestione")
    @Nullable
    private String gestione;

    @ColumnInfo(name = "data_ord")
    @Nullable
    private Date dataOrd;

    @ColumnInfo(name = "num_ord")
    @Nullable
    private Integer numOrd;

    @ColumnInfo(name = "cod_mdep")
    @Nullable
    private String codMdep;

    @Ignore
    private int countArticoli = 0;

    @ColumnInfo(name = "id_griglia")
    private int idGriglia;

    public int getOrdineId() {
        return ordineId;
    }

    public void setOrdineId(int ordineId) {
        this.ordineId = ordineId;
    }

    public Date getDataIns() {
        return dataIns;
    }

    public void setDataIns(Date dataIns) {
        this.dataIns = dataIns;
    }

    public String getAnnotazioni() {
        return annotazioni;
    }

    public void setAnnotazioni(String annotazioni) {
        this.annotazioni = annotazioni;
    }

    public int getIdGriglia() {
        return idGriglia;
    }

    public void setIdGriglia(int idGriglia) {
        this.idGriglia = idGriglia;
    }

    public boolean isTransmitted() {
        return transmitted;
    }

    public void setTransmitted(boolean transmitted) {
        this.transmitted = transmitted;
    }

    @Nullable
    public Date getTransmissionDate() {
        return transmissionDate;
    }

    public void setTransmissionDate(@Nullable Date transmissionDate) {
        this.transmissionDate = transmissionDate;
    }

    public int getCountArticoli() {
        return countArticoli;
    }

    public void setCountArticoli(int countArticoli) {
        this.countArticoli = countArticoli;
    }

    @Nullable
    public String getGestione() {
        return gestione;
    }

    public void setGestione(@Nullable String gestione) {
        this.gestione = gestione;
    }

    @Nullable
    public Date getDataOrd() {
        return dataOrd;
    }

    public void setDataOrd(@Nullable Date dataOrd) {
        this.dataOrd = dataOrd;
    }

    @Nullable
    public Integer getNumOrd() {
        return numOrd;
    }

    public void setNumOrd(@Nullable Integer numOrd) {
        this.numOrd = numOrd;
    }

    @Nullable
    public String getCodMdep() {
        return codMdep;
    }

    public void setCodMdep(@Nullable String codMdep) {
        this.codMdep = codMdep;
    }

    public void setDataOrdS(String dataOrd) {
        setDataOrd(UtilityDate.recognizeDateWithExceptionHandler(dataOrd));
    }
}
