package com.realnet.order_estimation.Services;
import java.util.*;
import com.realnet.order_estimation.Repository.ProductRepository;
import com.realnet.order_estimation.Entity.Product;

import com.realnet.order_estimation.Entity.Product_ListFilter1;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
	import org.springframework.stereotype.Service;

@Service
 public class Product_ListFilter1Service {
@Autowired
private ProductRepository Repository;




 public   List<Product_ListFilter1>   getlistbuilder() {
	List<Product> list= Repository.findAll();
		ArrayList<Product_ListFilter1> l = new ArrayList<>();
		for (Product data : list) {
boolean isactive = data.isActive();

				if (isactive) {String Type = data.getType();
 System.out.println(Type + "\n");

			if ("item".equals(Type)){	
Product_ListFilter1 dummy = new Product_ListFilter1();
			dummy.setId(data.getId());
  dummy.setProduct(data.getProduct());
	l.add(dummy);
}} 
} 		
return l;}



 public   List<Product_ListFilter1>   getlistbuilderparam(  String item) {
	List<Product> list= Repository.findAll();
		ArrayList<Product_ListFilter1> l = new ArrayList<>();
		for (Product data : list) {
boolean isactive = data.isActive();

				if (isactive) {String Type = data.getType();
 System.out.println(Type + "\n");

			if (item.equals(Type)){	
Product_ListFilter1 dummy = new Product_ListFilter1();
			dummy.setId(data.getId());
  dummy.setProduct(data.getProduct());
	l.add(dummy);
}} 
} 		
return l;}
}