package stockcontrol.sessions;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import stockcontrol.entities.Batch;

/**
 * 
 * @author matt
 *
 */
/**
 * A Wrapper Class thall provides a collection of Batches
 * 
 * @author matt
 *
 */
@XmlRootElement(name="batches")
@XmlAccessorType(XmlAccessType.FIELD)
public class BatchesDAO
{
	public Set<BatchDAO> batch;
	
	protected BatchesDAO() {} //default constructor
	
	/**
	 * Creates a BatchesDAO without product information
	 * @param lBat
	 */
	public BatchesDAO(Set<Batch> lBat)
	{
		this(lBat,false);
	}
	
	public BatchesDAO(List<BatchDAO> batchDOAs)
	{
		this.batch = new HashSet<>(batchDOAs);
	}
	
	/**
	 * Creates a BatchesDAO with product information
	 * @param lBat
	 * @param withProduct - true to include product information
	 */
	public BatchesDAO(Set<Batch> lBat,boolean withProduct)
	{
		this();
		batch = new HashSet<BatchDAO>();
		for (Batch c: lBat)
		{
			batch.add(new BatchDAO(c,withProduct));
		}
	}
}