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

import com.realnet.basicp1.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) {
String Type_name = data.getType_name();
 System.out.println(Type_name + "\n");

			if ("item".equals(Type_name)){	
Product_ListFilter1 dummy = new Product_ListFilter1();
			dummy.setId(data.getId());
  dummy.setProduct_name(data.getProduct_name());
	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) {
String Type_name = data.getType_name();
 System.out.println(Type_name + "\n");

			if (item.equals(Type_name)){	
Product_ListFilter1 dummy = new Product_ListFilter1();
			dummy.setId(data.getId());
  dummy.setProduct_name(data.getProduct_name());
	l.add(dummy);
} 
} 		
return l;}
}