{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tiro-ooo/json-schema/tiro-ooo-wiki-page-detail-schema.json",
  "title": "WikiPageDetail",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tiro-ooo-openapi.yml#/components/schemas/WikiPageDetail",
  "type": "object",
  "required": [
    "guid",
    "wikiId",
    "canonicalName",
    "pageType",
    "visibility",
    "visibilityEditable",
    "extractionStatus",
    "mentionCountVisible",
    "sourceNoteCountVisible",
    "mentions",
    "aliases",
    "links",
    "createdAt",
    "updatedAt"
  ],
  "properties": {
    "guid": {
      "type": "string",
      "description": "Wiki page GUID"
    },
    "wikiId": {
      "type": "integer",
      "format": "int64",
      "description": "Parent wiki ID"
    },
    "canonicalName": {
      "type": "string",
      "description": "Canonical name of the page"
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "User-provided page description or AI-generated summary"
    },
    "descriptionStatus": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "GENERATING",
        "AI_GENERATED",
        "USER_EDITED",
        "GENERATION_FAILED"
      ],
      "description": "Status of description backfill"
    },
    "regenerationAvailable": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Whether description can be regenerated"
    },
    "pageType": {
      "type": "string",
      "enum": [
        "CONCEPT",
        "DECISION",
        "ENTITY"
      ],
      "description": "Type of wiki page"
    },
    "entitySubtype": {
      "type": [
        "string",
        "null"
      ],
      "description": "Entity subtype"
    },
    "visibility": {
      "type": "string",
      "enum": [
        "PRIVATE",
        "WORKSPACE",
        "SOURCE_ACL"
      ],
      "description": "Who can see the page.\n- `SOURCE_ACL` — users who can read at least one linked source note. Default for pages created automatically from notes.\n- `PRIVATE` — only the user who created the page.\n- `WORKSPACE` — every member of the workspace.\n"
    },
    "visibilityEditable": {
      "type": "boolean",
      "description": "False when visibility is `SOURCE_ACL`; true for `PRIVATE` and `WORKSPACE` pages."
    },
    "extractionStatus": {
      "type": "string",
      "enum": [
        "NONE",
        "PENDING",
        "EXTRACTING",
        "READY",
        "FAILED"
      ],
      "description": "Current extraction status"
    },
    "mentionCountVisible": {
      "type": "integer",
      "description": "Number of visible mentions"
    },
    "sourceNoteCountVisible": {
      "type": "integer",
      "description": "Number of source notes with visible mentions"
    },
    "mentions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WikiMention"
      },
      "description": "List of mentions for this page"
    },
    "aliases": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WikiAlias"
      },
      "description": "List of aliases for this page"
    },
    "links": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WikiLink"
      },
      "description": "List of links (inbound and outbound)"
    },
    "lastUpdatedVisible": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "ISO 8601 timestamp of last visible update"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 creation timestamp"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 last update timestamp"
    }
  },
  "$defs": {
    "WikiAlias": {
      "type": "object",
      "required": [
        "guid",
        "alias",
        "source",
        "createdAt"
      ],
      "properties": {
        "guid": {
          "type": "string",
          "description": "Alias GUID"
        },
        "alias": {
          "type": "string",
          "description": "The alias string"
        },
        "source": {
          "type": "string",
          "enum": [
            "AUTO",
            "MANUAL"
          ],
          "description": "Source of the alias (AUTO extraction or MANUAL user input)"
        },
        "sourceMentionGuid": {
          "type": [
            "string",
            "null"
          ],
          "description": "Source mention GUID if extracted"
        },
        "sourceUserId": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "User ID who created the alias (if user-provided)"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 creation timestamp"
        }
      }
    },
    "WikiLink": {
      "type": "object",
      "required": [
        "guid",
        "sourcePageGuid",
        "targetPageGuid",
        "linkType",
        "linkTypeDisplayKo",
        "linkTypeDisplayEn",
        "isDirectional",
        "source",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "guid": {
          "type": "string",
          "description": "Link GUID"
        },
        "sourcePageGuid": {
          "type": "string",
          "description": "Source page GUID"
        },
        "sourcePageName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Source page canonical name"
        },
        "targetPageGuid": {
          "type": "string",
          "description": "Target page GUID"
        },
        "targetPageName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Target page canonical name"
        },
        "linkType": {
          "type": "string",
          "description": "Machine-readable link type code"
        },
        "linkTypeDisplayKo": {
          "type": "string",
          "description": "Korean display name for link type"
        },
        "linkTypeDisplayEn": {
          "type": "string",
          "description": "English display name for link type"
        },
        "isDirectional": {
          "type": "boolean",
          "description": "Whether the link is directional"
        },
        "source": {
          "type": "string",
          "enum": [
            "AUTO",
            "MANUAL",
            "REFRESH",
            "EVIDENCE"
          ],
          "description": "How the link was created"
        },
        "creatorUserId": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "User ID of the link creator (if user-provided)"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 creation timestamp"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 last update timestamp"
        }
      }
    },
    "WikiMention": {
      "type": "object",
      "required": [
        "guid",
        "noteId",
        "noteGuid",
        "kind",
        "sourceUserId",
        "extractedText",
        "createdAt"
      ],
      "properties": {
        "guid": {
          "type": "string",
          "description": "Mention GUID"
        },
        "noteId": {
          "type": "integer",
          "format": "int64",
          "description": "Source note ID"
        },
        "noteGuid": {
          "type": "string",
          "description": "Source note GUID. Pass it as `noteGuid` to the note endpoints, such as `GET /v1/external/notes/{noteGuid}`."
        },
        "paragraphId": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "Source paragraph ID within the note"
        },
        "paragraphUuid": {
          "type": [
            "string",
            "null"
          ],
          "description": "Source paragraph UUID"
        },
        "kind": {
          "type": "string",
          "enum": [
            "AUTO",
            "MANUAL",
            "USER_TAGGED"
          ],
          "description": "How the mention was created (AUTO extraction, MANUAL link, or USER_TAGGED)"
        },
        "sourceUserId": {
          "type": "integer",
          "format": "int64",
          "description": "User ID of the mention source"
        },
        "extractedText": {
          "type": "string",
          "description": "The extracted mention text from the note"
        },
        "confidence": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Confidence score for extraction (0-1)"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 mention creation timestamp"
        }
      }
    }
  }
}