package it.integry.integrywmsnative.core.rest.model;


import com.annimon.stream.Stream;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import it.integry.integrywmsnative.core.model.MtbColt;

public class SaveDocFromPickingRequestDTO {
	private String codAnag;
	private String codVdes;
	private String tipoLista;
	private String noteDoc;
	private Date dataDoc;
	private Integer numDoc;
	private List<DatiCollo> colli;
	private List<Pedane> pedane;

	public String getCodAnag() {
		return codAnag;
	}

	public SaveDocFromPickingRequestDTO setCodAnag(String codAnag) {
		this.codAnag = codAnag;
		return this;
	}

	public String getCodVdes() {
		return codVdes;
	}

	public SaveDocFromPickingRequestDTO setCodVdes(String codVdes) {
		this.codVdes = codVdes;
		return this;
	}

	public String getTipoLista() {
		return tipoLista;
	}

	public SaveDocFromPickingRequestDTO setTipoLista(String tipoLista) {
		this.tipoLista = tipoLista;
		return this;
	}

	public String getNoteDoc() {
		return noteDoc;
	}

	public SaveDocFromPickingRequestDTO setNoteDoc(String noteDoc) {
		this.noteDoc = noteDoc;
		return this;
	}

	public Date getDataDoc() {
		return dataDoc;
	}

	public SaveDocFromPickingRequestDTO setDataDoc(Date dataDoc) {
		this.dataDoc = dataDoc;
		return this;
	}

	public Integer getNumDoc() {
		return numDoc;
	}

	public SaveDocFromPickingRequestDTO setNumDoc(Integer numDoc) {
		this.numDoc = numDoc;
		return this;
	}

	public List<DatiCollo> getColli() {
		return colli;
	}

	public SaveDocFromPickingRequestDTO setColli(List<DatiCollo> colli) {
		this.colli = colli;
		return this;
	}

	public SaveDocFromPickingRequestDTO setColliFromMtbColts(List<MtbColt> colli) {
		if(colli == null) return this;

		this.colli = Stream.of(colli)
				.map(x -> new DatiCollo()
						.setDataCollo(x.getDataColloD())
						.setSerCollo(x.getSerCollo())
						.setNumCollo(x.getNumCollo())
						.setGestione(x.getGestione()))
				.toList();
		return this;
	}

	public List<Pedane> getPedane() {
		return pedane;
	}

	public void setPedane(List<Pedane> pedane) {
		this.pedane = pedane;
	}

	public static class Pedane {
		String codTcol;
		BigDecimal qta;

		public String getCodTcol() {
			return codTcol;
		}

		public void setCodTcol(String codTcol) {
			this.codTcol = codTcol;
		}

		public BigDecimal getQta() {
			return qta;
		}

		public void setQta(BigDecimal qta) {
			this.qta = qta;
		}
	}

	public static class DatiCollo {
		String gestione, serCollo;
		Date dataCollo;
		Integer numCollo;

		public String getGestione() {
			return gestione;
		}

		public DatiCollo setGestione(String gestione) {
			this.gestione = gestione;
			return this;
		}

		public String getSerCollo() {
			return serCollo;
		}

		public DatiCollo setSerCollo(String serCollo) {
			this.serCollo = serCollo;
			return this;
		}

		public Date getDataCollo() {
			return dataCollo;
		}

		public DatiCollo setDataCollo(Date dataCollo) {
			this.dataCollo = dataCollo;
			return this;
		}

		public Integer getNumCollo() {
			return numCollo;
		}

		public DatiCollo setNumCollo(Integer numCollo) {
			this.numCollo = numCollo;
			return this;
		}
	}
}
