{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://aigeoradar.com/schemas/aipm/1.3/page-manifest.schema.json",
    "title": "AI Page Manifest (AIPM)",
    "description": "Machine-readable page manifest for AI crawlers, RAG systems, and GEO discovery. Part of the AI Discovery Framework (ADF). AIPM v1.3.0 DRAFT expands relatedPages.relationship and optional trustSignals string fields. Production default remains v1.2 until cutover. Maintained by AigeoRadar.",
    "type": "object",
    "additionalProperties": false,
    "required": [
        "$schema",
        "specification",
        "manifestType",
        "maintainer",
        "purpose",
        "version",
        "id",
        "url",
        "canonical",
        "title",
        "inLanguage",
        "pageType",
        "abstract",
        "primaryTopic",
        "keywords",
        "audience",
        "contentHash",
        "wordCount",
        "readingTime",
        "readingLevel",
        "contentIntent",
        "topicCluster",
        "contentFreshness",
        "mainEntity",
        "secondaryEntities",
        "summary50",
        "summary150",
        "summary500",
        "keyFacts",
        "claims",
        "confidence",
        "relatedPages",
        "publisher",
        "citationPolicy",
        "speakable",
        "breadcrumb",
        "instructions",
        "updateFrequency",
        "lifecycle",
        "trustSignals",
        "assets",
        "availableActions",
        "faqEntity"
    ],
    "properties": {
        "$schema": {
            "type": "string",
            "format": "uri",
            "const": "https://aigeoradar.com/schemas/aipm/1.3/page-manifest.schema.json",
            "description": "JSON Schema URI for AI Page Manifest (AIPM) v1.3 draft."
        },
        "specification": {
            "type": "object",
            "additionalProperties": false,
            "required": ["name", "shortName", "version", "rfc"],
            "properties": {
                "name": { "type": "string", "const": "AI Page Manifest" },
                "shortName": { "type": "string", "const": "AIPM" },
                "version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
                "rfc": { "type": "string", "pattern": "^AIPM-\\d{3}$" }
            },
            "description": "Public specification identity for AI Page Manifest (AIPM)."
        },
        "manifestType": {
            "type": "string",
            "enum": ["page", "organization", "product", "faq", "service"],
            "description": "Manifest document type. Only page is produced in AIPM v1.1.1."
        },
        "maintainer": {
            "type": "object",
            "additionalProperties": false,
            "required": ["name", "url", "specification"],
            "properties": {
                "name": { "type": "string", "minLength": 1 },
                "url": { "type": "string", "format": "uri" },
                "specification": { "type": "string", "format": "uri" }
            },
            "description": "Organization maintaining this specification."
        },
        "purpose": {
            "type": "string",
            "minLength": 10,
            "maxLength": 500,
            "description": "Why this page exists — editorial one-sentence intent for AI systems."
        },
        "version": {
            "type": "string",
            "pattern": "^\\d+\\.\\d+\\.\\d+$",
            "description": "Semantic version of this manifest payload (e.g. 1.1.1).",
            "examples": ["1.1.1"]
        },
        "id": {
            "type": "string",
            "pattern": "^page_[a-f0-9]{8}$",
            "description": "Stable page identifier derived from canonical URL (SHA-256 prefix).",
            "examples": ["page_f495043e"]
        },
        "url": {
            "type": "string",
            "format": "uri",
            "description": "Public HTML page URL this card describes."
        },
        "canonical": {
            "type": "string",
            "format": "uri",
            "description": "Canonical URL for citation and deduplication. May differ from url when redirects or alternate paths exist."
        },
        "title": {
            "type": "string",
            "minLength": 1,
            "description": "Human-readable page title."
        },
        "inLanguage": {
            "type": "string",
            "pattern": "^[a-z]{2}(-[A-Z]{2})?$",
            "description": "BCP 47 language tag.",
            "examples": ["en", "tr"]
        },
        "pageType": {
            "type": "string",
            "enum": ["blog", "help", "product", "pricing", "legal", "faq"],
            "description": "High-level page classification for routing AI intent."
        },
        "datePublished": {
            "type": ["string", "null"],
            "format": "date",
            "description": "First publication date (ISO 8601 date). Null for evergreen static pages without a publish date."
        },
        "dateModified": {
            "type": ["string", "null"],
            "format": "date",
            "description": "Last substantive content update (ISO 8601 date)."
        },
        "abstract": {
            "type": "string",
            "description": "Factual summary (typically from meta description or help summary). Not marketing copy."
        },
        "primaryTopic": {
            "type": "string",
            "description": "Primary subject of the page for clustering and retrieval."
        },
        "keywords": {
            "type": "array",
            "items": { "type": "string", "minLength": 1 },
            "uniqueItems": true,
            "description": "GEO keywords and tags associated with this page."
        },
        "audience": {
            "type": "array",
            "items": {
                "type": "string",
                "minLength": 1
            },
            "minItems": 1,
            "description": "Intended reader or buyer segments. Prefer owner-verified audience from entity.json (business profile)."
        },
        "contentHash": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$",
            "description": "SHA-256 hash of title + abstract + body text + dateModified. Crawlers use this to detect content changes without re-fetching HTML."
        },
        "wordCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Approximate word count of visible page body text."
        },
        "readingTime": {
            "type": "integer",
            "minimum": 1,
            "description": "Estimated reading time in minutes (default: 220 words per minute)."
        },
        "readingLevel": {
            "type": "string",
            "enum": ["beginner", "intermediate", "advanced"],
            "description": "Technical depth of the content."
        },
        "contentIntent": {
            "type": "string",
            "enum": ["informational", "commercial", "transactional", "comparison", "documentation"],
            "description": "Primary user and AI intent signal for this page."
        },
        "topicCluster": {
            "type": "array",
            "items": { "type": "string", "minLength": 1 },
            "minItems": 1,
            "description": "Thematic cluster labels for cross-page linking and RAG routing.",
            "examples": [["AI Visibility", "GEO", "WordPress", "AI Discovery"]]
        },
        "contentFreshness": {
            "type": "object",
            "additionalProperties": false,
            "required": ["status", "daysSinceModified", "modifiedAt"],
            "properties": {
                "status": {
                    "type": "string",
                    "enum": ["current", "fresh", "aging", "stale", "unknown"],
                    "description": "current ≤30d, fresh ≤90d, aging ≤180d, stale >180d, unknown when dateModified is absent."
                },
                "daysSinceModified": {
                    "type": ["integer", "null"],
                    "minimum": 0
                },
                "modifiedAt": {
                    "type": ["string", "null"],
                    "format": "date"
                }
            }
        },
        "mainEntity": {
            "type": "array",
            "description": "Named entities mentioned on this page (products, concepts, discovery files).",
            "items": { "$ref": "#/$defs/namedEntity" }
        },
        "secondaryEntities": {
            "type": "array",
            "description": "Related platform entities and discovery assets referenced across the site.",
            "items": { "$ref": "#/$defs/namedEntityWithOptionalUrl" }
        },
        "summary50": {
            "type": "string",
            "maxLength": 50,
            "description": "Ultra-short factual summary (~50 characters) for tight context windows."
        },
        "summary150": {
            "type": "string",
            "maxLength": 160,
            "description": "Short summary (~150 characters) — preferred default for most LLM citations."
        },
        "summary500": {
            "type": "string",
            "maxLength": 520,
            "description": "Extended factual summary (~500 characters) for deeper RAG context."
        },
        "keyFacts": {
            "type": "array",
            "items": { "type": "string", "minLength": 10 },
            "maxItems": 10,
            "description": "Editorially authored atomic facts (3–7 recommended). Automatic extraction is not permitted in v1.1.1."
        },
        "claims": {
            "type": "array",
            "items": { "$ref": "#/$defs/claim" },
            "description": "Verifiable claims with evidence URLs."
        },
        "confidence": {
            "type": "string",
            "enum": ["official", "verified", "estimated"],
            "description": "Publisher confidence level for facts on this page."
        },
        "reviewedBy": {
            "type": "string",
            "description": "Editorial or team responsible for factual review."
        },
        "reviewDate": {
            "type": ["string", "null"],
            "format": "date",
            "description": "Date of last editorial review. Often mirrors dateModified."
        },
        "relatedPages": {
            "type": "array",
            "items": { "$ref": "#/$defs/relatedPage" },
            "maxItems": 10,
            "description": "Semantically related pages with relationship types."
        },
        "publisher": {
            "type": "object",
            "additionalProperties": false,
            "required": ["@id", "name", "url"],
            "properties": {
                "@id": {
                    "type": "string",
                    "format": "uri",
                    "description": "Publisher entity graph URI (typically /entity.json)."
                },
                "name": { "type": "string" },
                "url": {
                    "type": "string",
                    "format": "uri"
                }
            }
        },
        "citationPolicy": {
            "type": "array",
            "items": { "type": "string", "minLength": 10 },
            "minItems": 1,
            "description": "Rules for AI systems citing or summarizing this publisher. Includes entity.json precedence on conflicts."
        },
        "speakable": {
            "type": "object",
            "additionalProperties": false,
            "required": ["@type", "cssSelector", "summary", "ssml"],
            "properties": {
                "@type": {
                    "type": "string",
                    "const": "SpeakableSpecification"
                },
                "cssSelector": {
                    "type": "array",
                    "items": { "type": "string" },
                    "minItems": 1
                },
                "summary": {
                    "type": "string",
                    "maxLength": 160,
                    "description": "Plain-text speakable summary."
                },
                "ssml": {
                    "type": "string",
                    "description": "SSML-wrapped speakable version for voice assistants.",
                    "pattern": "^<speak>"
                }
            }
        },
        "breadcrumb": {
            "type": "array",
            "items": { "$ref": "#/$defs/breadcrumbItem" },
            "minItems": 1
        },
        "instructions": {
            "type": "object",
            "additionalProperties": false,
            "required": ["preferredSummaryLength", "preferredCitation", "allowQuotation", "maxQuoteWords"],
            "properties": {
                "preferredSummaryLength": {
                    "type": "integer",
                    "enum": [50, 150, 500],
                    "description": "Preferred summary field: summary50, summary150, or summary500."
                },
                "preferredCitation": {
                    "type": "string",
                    "enum": ["url", "title", "publisher"],
                    "description": "How to attribute citations from this page."
                },
                "allowQuotation": { "type": "boolean" },
                "maxQuoteWords": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                }
            },
            "description": "Machine instructions for LLMs consuming this card."
        },
        "updateFrequency": {
            "type": "string",
            "enum": ["weekly", "monthly", "yearly", "dynamic"],
            "description": "Expected cadence of content updates."
        },
        "lifecycle": {
            "type": "string",
            "enum": ["evergreen", "seasonal", "deprecated", "dynamic"],
            "description": "Content lifecycle classification."
        },
        "trustSignals": {
            "type": "object",
            "additionalProperties": false,
            "required": ["officialPublisher", "structuredData", "entityFile", "knowledgeFile"],
            "properties": {
                "officialPublisher": { "type": "boolean" },
                "structuredData": { "type": "boolean" },
                "entityFile": { "type": "boolean" },
                "knowledgeFile": { "type": "boolean" },
                "author": { "type": "string", "minLength": 1, "description": "Optional editorial author (v1.3)." },
                "editor": { "type": "string", "minLength": 1, "description": "Optional editor (v1.3)." },
                "documentationUrl": { "type": "string", "format": "uri", "description": "Docs URL for this page (v1.3)." },
                "version": { "type": "string", "minLength": 1, "description": "Content or product version label (v1.3)." },
                "releaseDate": { "type": "string", "description": "Release or reviewed date (v1.3)." }
            },
            "description": "Publisher trust indicators for AI citation decisions (booleans required; string fields optional in v1.3)."
        },
        "assets": {
            "type": "object",
            "additionalProperties": false,
            "required": ["entity", "knowledge", "feed", "llms", "llmsFull", "schema"],
            "properties": {
                "entity": { "type": "string", "format": "uri" },
                "knowledge": { "type": "string", "format": "uri" },
                "feed": { "type": "string", "format": "uri" },
                "llms": { "type": "string", "format": "uri" },
                "llmsFull": { "type": "string", "format": "uri" },
                "schema": { "type": "string", "format": "uri", "description": "Organization/entity JSON-LD source (entity.json)." }
            },
            "description": "Site-wide AI discovery asset URLs discoverable from any page card."
        },
        "availableActions": {
            "type": "array",
            "items": { "$ref": "#/$defs/action" },
            "description": "Actions an AI assistant may suggest to users reading about this publisher."
        },
        "faqEntity": {
            "type": "array",
            "description": "Schema.org FAQ Question/Answer items when pageType is faq. Empty array on non-FAQ pages.",
            "items": { "$ref": "#/$defs/faqQuestion" }
        }
    },
    "$defs": {
        "namedEntity": {
            "type": "object",
            "additionalProperties": false,
            "required": ["name", "type"],
            "properties": {
                "name": { "type": "string", "minLength": 1 },
                "type": {
                    "type": "string",
                    "enum": ["Software", "Concept", "DiscoveryFile", "Organization", "Thing"]
                },
                "importance": {
                    "type": "string",
                    "enum": ["primary", "secondary", "mentioned"],
                    "description": "Entity salience on this page (v1.2.0)."
                }
            }
        },
        "namedEntityWithOptionalUrl": {
            "type": "object",
            "additionalProperties": false,
            "required": ["name", "type"],
            "properties": {
                "name": { "type": "string", "minLength": 1 },
                "type": {
                    "type": "string",
                    "enum": ["Software", "Concept", "DiscoveryFile", "Organization", "Thing"]
                },
                "url": { "type": "string", "format": "uri" }
            }
        },
        "claim": {
            "type": "object",
            "additionalProperties": false,
            "required": ["text", "type", "evidence", "confidence"],
            "properties": {
                "text": { "type": "string", "minLength": 10 },
                "type": {
                    "type": "string",
                    "enum": ["internal", "external"],
                    "description": "internal = publisher evidence; external = third-party source."
                },
                "evidence": { "type": "string", "format": "uri" },
                "confidence": {
                    "type": "string",
                    "enum": ["official", "verified", "estimated"]
                }
            }
        },
        "relatedPage": {
            "type": "object",
            "additionalProperties": false,
            "required": ["url", "title", "pageType", "relationship"],
            "properties": {
                "url": { "type": "string", "format": "uri" },
                "title": { "type": "string", "minLength": 1 },
                "pageType": {
                    "type": "string",
                    "enum": ["blog", "help", "product", "pricing", "legal", "faq"]
                },
                "relationship": {
                    "type": "string",
                    "enum": ["supports", "extends", "tutorial", "overview", "reference", "implementation", "follow-up", "relatedConcept"]
                },
                "anchor": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 120,
                    "description": "Suggested link text for AI citation (v1.2.0)."
                }
            }
        },
        "breadcrumbItem": {
            "type": "object",
            "additionalProperties": false,
            "required": ["name", "url"],
            "properties": {
                "name": { "type": "string", "minLength": 1 },
                "url": { "type": "string", "format": "uri" }
            }
        },
        "action": {
            "type": "object",
            "additionalProperties": false,
            "required": ["action", "label", "url"],
            "properties": {
                "action": {
                    "type": "string",
                    "enum": ["scan", "deploy", "readDocs", "contact", "pricing"]
                },
                "label": { "type": "string", "minLength": 1 },
                "url": { "type": "string", "format": "uri" }
            }
        },
        "faqQuestion": {
            "type": "object",
            "additionalProperties": false,
            "required": ["@type", "name", "acceptedAnswer"],
            "properties": {
                "@type": { "type": "string", "const": "Question" },
                "name": { "type": "string", "minLength": 1 },
                "acceptedAnswer": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["@type", "text"],
                    "properties": {
                        "@type": { "type": "string", "const": "Answer" },
                        "text": { "type": "string", "minLength": 1 }
                    }
                }
            }
        }
    }
}
