package com.realnet.Dashboard_builder.Controllers;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.*;

@RestController
public class DashboardMockController {

	@GetMapping("/api/getDummyDashboardData")
	public ResponseEntity<List<Map<String, Object>>> getDummyDashboardData() {
		List<Map<String, Object>> dataList = new ArrayList<>();

		String[] salesReps = { "Gaurav", "Ravi", "Ankit", "Neha", "Kiran" };
		String[] partners = { "IBM", "Microsoft", "TCS", "Infosys", "Wipro" };
		String[] regions = { "Asia", "Europe", "North America", "South America", "Africa" };
		String[] channels = { "Online", "Retail", "Direct", "Distributor", "Reseller" };
		String[] products = { "Laptops", "Servers", "Networking", "Cloud", "AI" };

		for (int i = 1; i <= 50; i++) {
			Map<String, Object> row = new LinkedHashMap<>();

			// 🧩 Fixed pattern numeric data
			row.put("leadCount", 100 + (i * 10));
			row.put("dealValue", 5000 + (i * 750));
			row.put("conversionRate", (i % 100));
			row.put("activeUsers", 50 + (i * 5));
			row.put("visits", 200 + (i * 15));

			// 🧠 Repeated pattern text data
			row.put("salesRep", salesReps[i % salesReps.length]);
			row.put("partner", partners[i % partners.length]);
			row.put("region", regions[i % regions.length]);
			row.put("channel", channels[i % channels.length]);
			row.put("productLine", products[i % products.length]);

			// 📅 Sequential date data
			row.put("createdDate", LocalDate.of(2024, (i % 12) + 1, ((i % 28) + 1)));
			row.put("lastUpdated", LocalDate.of(2025, ((i + 2) % 12) + 1, ((i + 3) % 28) + 1));

			dataList.add(row);
		}

		return ResponseEntity.ok(dataList);
	}
}
