package com.realnet.basicp1.Services;
import java.util.*;
import com.realnet.basicp1.Repository.DistricRepository;
import com.realnet.basicp1.Entity.Distric;

import com.realnet.basicp1.Entity.Distric_ListFilter1;
import java.util.List;

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

@Service
 public class Distric_ListFilter1Service {
@Autowired
private DistricRepository Repository;




 public   List<Distric_ListFilter1>   getlistbuilder() {
	List<Distric> list= Repository.findAll();
		ArrayList<Distric_ListFilter1> l = new ArrayList<>();
		for (Distric data : list) {
String State_name = data.getState_name();
 System.out.println(State_name + "\n");

			if ("item".equals(State_name)){	
Distric_ListFilter1 dummy = new Distric_ListFilter1();
			dummy.setId(data.getId());
  dummy.setDistrict_name(data.getDistrict_name());
	l.add(dummy);
} 
} 		
return l;}



 public   List<Distric_ListFilter1>   getlistbuilderparam(  String item) {
	List<Distric> list= Repository.findAll();
		ArrayList<Distric_ListFilter1> l = new ArrayList<>();
		for (Distric data : list) {
String State_name = data.getState_name();
 System.out.println(State_name + "\n");

			if (item.equals(State_name)){	
Distric_ListFilter1 dummy = new Distric_ListFilter1();
			dummy.setId(data.getId());
  dummy.setDistrict_name(data.getDistrict_name());
	l.add(dummy);
} 
} 		
return l;}
}