const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;

export function validateMicrosoftClientId(raw: unknown): string {
  if (typeof raw !== "string" || !UUID.test(raw.trim())) {
    throw new Error("Saisis l’Application (client) ID Entra au format UUID, par exemple 12345678-1234-4234-9234-123456789abc");
  }
  return raw.trim().toLowerCase();
}
