// Canonical brand-voice phrase library for RankWizAI.
// Voice contract: operator-singular, consequence-led, contractions OK, no "please."
// See: resources/views/errors/404.blade.php for the gold-standard tone reference.

export interface DestructiveConfirmCopy {
  title: string;
  body: string;
  primaryLabel: string;
  cancelLabel: string;
}

/**
 * Consequence-led confirmation copy for destructive actions.
 * Lead with what happens, not "Are you sure."
 *
 * @param consequence Short sentence stating what will be lost/changed (shown as dialog title).
 * @param detail      Optional extra body sentence (e.g. count or scope context).
 * @param primaryLabel Override the confirm button label (default: "Confirm").
 */
export function destructiveConfirm(
  consequence: string,
  detail?: string,
  primaryLabel?: string,
): DestructiveConfirmCopy {
  return {
    title: consequence,
    body: detail ?? "This can't be undone.",
    primaryLabel: primaryLabel ?? 'Confirm',
    cancelLabel: 'Cancel',
  };
}

/**
 * Brand-voice error fallback.
 * Tone: "this isn't your fault" + operator will sort it.
 */
export function errorRetry(context?: string): { title: string; message: string } {
  const where = context ? ` on the ${context}` : '';
  return {
    title: `Something went wrong${where}`,
    message: "This isn't your fault. Try again — if it keeps happening, reply and I'll sort it.",
  };
}

/**
 * Brand-voice empty-state body.
 * States what will appear once the user takes action.
 */
export function emptyHint(noun: string, why: string): string {
  return `No ${noun} yet. ${why}`;
}

/**
 * Success confirmation: "{Action} done. {after-effect}"
 */
export function successConfirmation(action: string, afterEffect?: string): string {
  const suffix = afterEffect ? ` ${afterEffect}` : '';
  return `${action} done.${suffix}`;
}

/**
 * Inline validation copy: "{Field} {rule}."
 */
export function validation(field: string, rule: string): string {
  return `${field} ${rule}.`;
}

/**
 * Operator-singular signoff — the "I'll fix it" cadence from 404.blade.php.
 */
export function signatureSignoff(): string {
  return "RankWizAI is a small operation. Reply with the URL and I'll fix it.";
}
