import { normalizeBranchIdInput } from "@/lib/frontend/admin/users/userManagementUx";

export const ROLE_LABELS_DE = Object.freeze({
	branch: "Niederlassung",
	admin: "Admin",
	superadmin: "Superadmin",
	dev: "Entwicklung",
});

export const ROLE_OPTIONS_DE = Object.freeze([
	{ value: "", label: "Alle Rollen" },
	{ value: "branch", label: ROLE_LABELS_DE.branch },
	{ value: "admin", label: ROLE_LABELS_DE.admin },
	{ value: "superadmin", label: ROLE_LABELS_DE.superadmin },
	{ value: "dev", label: ROLE_LABELS_DE.dev },
]);

export function formatDateTimeDe(iso) {
	if (!iso) return "—";
	try {
		return new Date(iso).toLocaleString("de-DE");
	} catch {
		return "—";
	}
}

export function normalizeBranchIdDraft(value) {
	return normalizeBranchIdInput(value);
}
