package com.uas.platform.b2b.erp.service.impl;

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

import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;

import com.uas.platform.b2b.erp.model.SaleSampleApproval;
import com.uas.platform.b2b.erp.model.SaleSampleDown;
import com.uas.platform.b2b.erp.model.SaleSampleSend;
import com.uas.platform.b2b.erp.service.SaleSampleDownService;
import com.uas.platform.b2b.model.PurchaseProofingApproval;
import com.uas.platform.b2b.model.PurchaseProofingItem;
import com.uas.platform.b2b.model.PurchaseProofingSend;

@Service
public class SaleSampleDownServiceImpl implements SaleSampleDownService {

	@Override
	public List<SaleSampleDown> convertPurchaseProofingItems(
			List<PurchaseProofingItem> proofingItems) {
		List<SaleSampleDown> saleSampleDowns = new ArrayList<SaleSampleDown>();
		if(!CollectionUtils.isEmpty(proofingItems)) {
			for(PurchaseProofingItem proofingItem : proofingItems) {
				saleSampleDowns.add(new SaleSampleDown(proofingItem));
			}
		}
		return saleSampleDowns;
	}

	@Override
	public List<SaleSampleSend> convertSaleSampleSends(
			List<PurchaseProofingSend> proofingSends) {
		List<SaleSampleSend> saleSampleSends = new ArrayList<SaleSampleSend>();
		if(!CollectionUtils.isEmpty(proofingSends)) {
			for(PurchaseProofingSend proofingSend : proofingSends){
				saleSampleSends.add(new SaleSampleSend(proofingSend));
			}
		}
		return saleSampleSends;
	}

	@Override
	public List<PurchaseProofingSend> convertProofingSends(
			List<SaleSampleSend> saleSampleSends) {
		List<PurchaseProofingSend> proofingSends = new ArrayList<PurchaseProofingSend>();
		if(!CollectionUtils.isEmpty(saleSampleSends)) {
			for(SaleSampleSend saleSampleSend : saleSampleSends){
				proofingSends.add(saleSampleSend.convert());
			}
		}
		return proofingSends;
	}

	@Override
	public List<SaleSampleApproval> covertSampleApprovals(
			List<PurchaseProofingApproval> proofingApprovals) {
		List<SaleSampleApproval> saleSampleApprovals = new ArrayList<SaleSampleApproval>();
		if(!CollectionUtils.isEmpty(proofingApprovals)) {
			for(PurchaseProofingApproval proofingApproval : proofingApprovals) {
				saleSampleApprovals.add(new SaleSampleApproval(proofingApproval));
			}
		}
		return saleSampleApprovals;
	}


}
