#!/usr/bin/env bash

: <<'DOC'
API for reading Blizz agent configuration from manifest.json.

Repos opt in to Blizz features by setting fields under the "blizz" key
in their manifest:

  {
    "blizz": {
      "triage": true
      "review": true
      "development": true
    }
  }
DOC


: <<'DOC'
Whether Blizz should include this repo in automated issue triage.

Usage: blizz_triage_enabled "$manifest_json" && echo "opted in"
DOC
function blizz_triage_enabled() {
  local manifest="$1"
  local enabled
  enabled="$(jq_get "$manifest" '.blizz.triage' 'false')"
  [[ "$enabled" == "true" ]]
}

: <<'DOC'
Whether Blizz should participate in PR reviews for this repo.

Usage: blizz_review_enabled "$manifest_json" && echo "opted in"
DOC
function blizz_review_enabled() {
  local manifest="$1"
  local enabled
  enabled="$(jq_get "$manifest" '.blizz.review' 'false')"
  [[ "$enabled" == "true" ]]
}

: <<'DOC'
Whether Blizz can perform agentic development tasks in this repo.

Usage: blizz_development_enabled "$manifest_json" && echo "opted in"
DOC
function blizz_development_enabled() {
  local manifest="$1"
  local enabled
  enabled="$(jq_get "$manifest" '.blizz.development' 'false')"
  [[ "$enabled" == "true" ]]
}
