// ═══════════════════════════════════════════════════════════════
// VEDA-AUDIT.rustba — Resume audit program in Rustba
// Agent: Veda — the auditor. Every audit rule is an effect;
// every rule is a `needs` guard. A resume passes when all
// effects clear their guards. Nothing passes on vibes.
// ═══════════════════════════════════════════════════════════════

hw {
  battery: 100
  network: offline
  thermal: nominal
}

state resume_text = ""
state audit_run = false
state verdict = "not run"

// ── Audit thresholds (the law) ──────────────────────────────
state min_bullets_per_role = 4
state max_pages = 3
state required_font = "Arial"

// ── Screens ─────────────────────────────────────────────────
screen Intake {
  layout: stack(safe)
  title "Veda Audit"
  text "Paste resume text. Veda runs every guard."
  input "Resume text"
  button "Run Audit" ! runAudit
  on swipe(left) -> Report
}

screen Report {
  layout: stack(safe)
  title "Audit Report"
  text "Verdict: {verdict}"
  list "Failed guards" [failed_guards] -> reviewed
  button "Re-run" ! runAudit
  button "Back" -> Intake
  on swipe(right) -> Intake
}

// ── Audit effects: one per rule ─────────────────────────────
// Structure
effect auditSummary : Document {
  needs has_summary == true
  needs summary_lines <= 5
}

effect auditBullets : Document {
  needs bullets_per_role >= min_bullets_per_role
  needs bullet_variety >= 3
}

effect auditPages : Document {
  needs pages <= max_pages
  needs pages >= 1
}

// SEO / keywords
effect auditKeywords : Document {
  needs keyword_hits >= 8
  needs has_skills_section == true
}

// Formatting
effect auditFormat : Document {
  needs font_family == required_font
  needs has_clear_headings == true
  needs wall_of_text == false
}

// Truth — the highest guard
effect auditTruth : Document + Network {
  needs every_claim_cited == true
  needs no_fabricated_numbers == true
  needs no_fabricated_links == true
}

// The run: all effects, in order. First failure stops the line.
effect runAudit : Document {
  needs auditSummary == pass
  needs auditBullets == pass
  needs auditPages == pass
  needs auditKeywords == pass
  needs auditFormat == pass
  needs auditTruth == pass
}
