/**
 * W-C — frontend mirror of the backend draftability source of truth
 * (App\Enums\ActionType::draftableValues()).
 *
 * Keep this set in sync with ActionType::isDraftable(). The server-side guard
 * in AiController::generateSingle() is the authoritative check; this is the UI
 * affordance gate so we never offer "Generate draft" for an action the server
 * will reject.
 */
export const DRAFTABLE_ACTION_TYPES = [
  'content_rewrite',
  'light_refresh',
  'section_refresh',
  'full_rewrite',
  'reposition_intent',
  'eeat_improvement',
  'geo_improvement',
  'thin_content',
  'citation_optimization', // R-2: AIO citation tactics are AI-draftable (answer-first block, FAQ)
] as const;

export type DraftableActionType = (typeof DRAFTABLE_ACTION_TYPES)[number];

/**
 * Whether a raw action_type string is eligible for AI draft generation.
 * Unknown / non-draftable values return false.
 */
export function isDraftableAction(actionType: string | null | undefined): boolean {
  if (!actionType) {
    return false;
  }

  return (DRAFTABLE_ACTION_TYPES as readonly string[]).includes(actionType);
}
