import { Key } from "@iconoir/vue";

class DataUtils {
	// static buildClientData(clients) {
	//     const address = `${client["address"]["address_line_1"] || ""} ${client["address"]["address_line_2"] || ""} ${client["address"]["city"] || ""} ${client["address"]["state"] || ""}`.trim();
	//     const clientName = `${client["customer"]["customer_name"] || "N/A"} ${address}`;
	//     return clients.map((client) => [clientName, client.]
	// }

	static calculateStepProgress(steps) {
		if (!steps || steps.length === 0) return "0/0";
		const completedSteps = steps.filter((step) => step.status === "completed").length;
		return `${completedSteps}/${steps.length}`;
	}

	static US_STATES = [
		"AL",
		"AK",
		"AZ",
		"AR",
		"CA",
		"CO",
		"CT",
		"DE",
		"FL",
		"GA",
		"HI",
		"ID",
		"IL",
		"IN",
		"IA",
		"KS",
		"KY",
		"LA",
		"ME",
		"MD",
		"MA",
		"MI",
		"MN",
		"MS",
		"MO",
		"MT",
		"NE",
		"NV",
		"NH",
		"NJ",
		"NM",
		"NY",
		"NC",
		"ND",
		"OH",
		"OK",
		"OR",
		"PA",
		"RI",
		"SC",
		"SD",
		"TN",
		"TX",
		"UT",
		"VT",
		"VA",
		"WA",
		"WV",
		"WI",
		"WY",
	];

	static calculateFullAddress(address) {
		if (!address) return "";

		// Build address parts with spaces, except comma between city and state
		const addressParts = [];

		// Add address lines with spaces
		if (address.addressLine1?.trim()) addressParts.push(address.addressLine1.trim());
		if (address.addressLine2?.trim()) addressParts.push(address.addressLine2.trim());

		// Add city, state with comma, and zip
		const cityStateParts = [];
		if (address.city?.trim()) cityStateParts.push(address.city.trim());
		if (address.state?.trim()) cityStateParts.push(address.state.trim());

		// Join city and state with comma, then add to address
		if (cityStateParts.length > 0) {
			addressParts.push(cityStateParts.join(", "));
		}

		// Add zip code
		if (address.pincode?.trim()) addressParts.push(address.pincode.trim());

		// Join all parts with spaces
		return addressParts.join(" ").trim();
	}
}

export default DataUtils;
