{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Public Comment Input",
  "description": "Input schema for the public-comment skill: one operation on the public-review comment store of a document folio.",
  "type": "object",
  "required": [
    "operation"
  ],
  "properties": {
    "operation": {
      "type": "string",
      "enum": [
        "import",
        "import-narrative",
        "list",
        "triage",
        "reassign",
        "assign",
        "recommend",
        "decide",
        "incorporate",
        "duplicate",
        "withdraw",
        "github",
        "summary"
      ],
      "description": "One task of public-comment.bpmn, or a read (list, summary)."
    },
    "file": {
      "type": "string",
      "description": "For import / import-narrative: the comment matrix (.xlsx), form export (.csv) or narrative text."
    },
    "ref": {
      "type": "string",
      "pattern": "^PC-\\d{4,}$",
      "description": "The comment the operation acts on."
    },
    "to": {
      "type": "string",
      "description": "reassign/triage: a block or section label. assign: GitHub login(s), comma-separated."
    },
    "code": {
      "type": "string",
      "enum": [
        "accepted",
        "accepted-modified",
        "not-accepted",
        "noted",
        "deferred"
      ],
      "description": "recommend / decide: the decision code."
    },
    "reason": {
      "type": "string",
      "description": "decide: required for every code but accepted."
    },
    "branch": {
      "type": "string",
      "description": "decide / incorporate: the change-set branch."
    },
    "pr": {
      "type": "integer",
      "description": "decide / incorporate: the change-set pull request."
    },
    "filter": {
      "type": "object",
      "description": "list: narrow by status (or 'open'), page, line, block, section, or unplaced.",
      "properties": {
        "status": {
          "type": "string"
        },
        "page": {
          "type": "integer"
        },
        "line": {
          "type": "integer"
        },
        "block": {
          "type": "string"
        },
        "section": {
          "type": "string"
        },
        "unplaced": {
          "type": "boolean"
        }
      }
    },
    "stagingLinks": {
      "$ref": "#/definitions/stagingLinks",
      "description": "The staging preview of the work under review, as the request for feedback carried it, so the reviewer opens the changed pages rather than rebuilding links. Rule: cat-harness sdlc/skills/sdlc-core/staging-review.md §\"The deep-link rule\"."
    }
  },
  "definitions": {
    "stagingLinks": {
      "title": "Staging links",
      "description": "The staging preview of the work a request for feedback is about: one deep link per changed page (the page and the anchor where the change sits) with the same page on main as `before`. Mirrors StagingComparison in schemas/sdlc/staging.ts. The rule is skills/authoring/content-lifecycle/feedback-deep-links.md. Copied inline as `definitions.stagingLinks` into every skill contract that carries it; schemas/staging.test.ts fails when a copy drifts.",
      "type": "object",
      "required": [
        "branch",
        "slug",
        "branchUrl",
        "mainBaseUrl",
        "stagingBaseUrl",
        "pages"
      ],
      "properties": {
        "branch": {
          "type": "string",
          "description": "Feature branch name."
        },
        "slug": {
          "type": "string",
          "description": "Branch slug used in the staging URL path."
        },
        "branchUrl": {
          "type": "string",
          "format": "uri"
        },
        "pr": {
          "type": "integer",
          "minimum": 1
        },
        "mainBaseUrl": {
          "type": "string",
          "format": "uri"
        },
        "stagingBaseUrl": {
          "type": "string",
          "format": "uri"
        },
        "pages": {
          "type": "array",
          "description": "One entry per changed page, deep-linked; from the change's rendered-impact list, never chosen by judgement.",
          "items": {
            "type": "object",
            "required": [
              "title"
            ],
            "properties": {
              "title": {
                "type": "string"
              },
              "before": {
                "type": "string",
                "format": "uri",
                "description": "Same page on main; absent for a new page."
              },
              "after": {
                "type": "string",
                "format": "uri",
                "description": "The page on the staging preview, with the anchor where the change sits; absent for a deleted page."
              },
              "summary": {
                "type": "string",
                "description": "What to look at on this page."
              }
            }
          }
        },
        "missing": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "What could not be linked, said rather than hidden: no preview yet (and when it will exist), no page list computed, or a changed page the publish ref does not hold."
        }
      },
      "$comment": "Copy of cat-harness schemas/staging-comparison.schema.json; cat-harness schemas/staging.test.ts fails when a copy drifts."
    }
  },
  "$id": "https://litlfred.github.io/folio-assistant/folio-assistant-core/schema/skills/public-comment/input.schema.json"
}
