{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://robot-trust.org/schema/robots-trust-v1.json",
    "title": "Robot Trust Certificate",
    "description": "Schema for the robots-trust.json standard v1.0. Place at /.well-known/robots-trust.json.",
    "type": "object",
    "required": [
        "robot_trust_version",
        "trust_status"
    ],
    "properties": {
        "robot_trust_version": {
            "type": "string",
            "description": "Version of the Robot Trust standard.",
            "enum": [
                "1.0"
            ]
        },
        "schema": {
            "type": "string",
            "description": "URL of the JSON schema used to validate this file.",
            "format": "uri"
        },
        "protocol": {
            "type": "string",
            "description": "URL of the human-readable protocol specification.",
            "format": "uri"
        },
        "type": {
            "type": "string",
            "description": "File role: 'certificate' for site certs, 'registry' for authority root.",
            "enum": [
                "certificate",
                "registry"
            ]
        },
        "site_identity": {
            "type": "object",
            "description": "Identification of the site or authority.",
            "properties": {
                "site_name": {
                    "type": "string"
                },
                "domain": {
                    "type": "string"
                },
                "owner_type": {
                    "type": "string",
                    "enum": [
                        "company",
                        "individual",
                        "robot-operator",
                        "ai-platform"
                    ]
                },
                "purpose": {
                    "type": "string"
                }
            },
            "required": [
                "domain"
            ]
        },
        "trust_status": {
            "type": "object",
            "description": "Certificate trust level and status.",
            "properties": {
                "robot_access": {
                    "type": "string",
                    "enum": [
                        "allowed",
                        "restricted",
                        "denied"
                    ]
                },
                "certificate_issuer": {
                    "type": "string",
                    "description": "Must be 'robot-trust.org' for certified sites."
                },
                "certificate_status": {
                    "type": "string",
                    "enum": [
                        "verified",
                        "pending",
                        "revoked"
                    ]
                },
                "trust_level": {
                    "type": "string",
                    "enum": [
                        "basic",
                        "pro",
                        "enterprise",
                        "authority"
                    ]
                },
                "issued": {
                    "type": "string",
                    "description": "ISO 8601 date of certificate issuance.",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "expires": {
                    "type": "string",
                    "description": "ISO 8601 date of certificate expiry.",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                }
            },
            "required": [
                "robot_access",
                "certificate_status"
            ]
        },
        "ai_readability": {
            "type": "object",
            "properties": {
                "machine_readable": {
                    "type": "boolean"
                },
                "structured_data_available": {
                    "type": "boolean"
                },
                "robot_priority_mode": {
                    "type": "boolean"
                }
            }
        },
        "access_points": {
            "type": "object",
            "properties": {
                "preferred_entry": {
                    "type": "string"
                },
                "robot_safe_endpoints": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "rate_limit_policy": {
                    "type": "string",
                    "enum": [
                        "ai-friendly",
                        "standard",
                        "strict"
                    ]
                }
            }
        },
        "ai_training": {
            "type": "object",
            "description": "AI training permission flags.",
            "properties": {
                "training_allowed": {
                    "type": "boolean"
                },
                "commercial_training_allowed": {
                    "type": "boolean"
                },
                "scraping_allowed": {
                    "type": "boolean"
                },
                "attribution_required": {
                    "type": "boolean"
                }
            }
        },
        "ai_policy": {
            "type": "object",
            "description": "Simplified AI policy block for easy agent parsing.",
            "properties": {
                "agents": {
                    "type": "string",
                    "description": "Whether AI agents may interact with this site.",
                    "enum": ["allowed", "restricted", "denied"]
                },
                "training": {
                    "type": "string",
                    "description": "Whether content may be used for AI training.",
                    "enum": ["allowed", "restricted", "denied"]
                },
                "scraping": {
                    "type": "string",
                    "description": "Whether automated scraping is permitted.",
                    "enum": ["allowed", "limited", "denied"]
                }
            }
        },
        "content_policy": {
            "type": "object",
            "properties": {
                "human_site_available": {
                    "type": "boolean"
                },
                "ai_generated_content_allowed": {
                    "type": "boolean"
                },
                "automation_interaction_allowed": {
                    "type": "boolean"
                }
            }
        },
        "capabilities": {
            "type": "object",
            "properties": {
                "supports_ai_navigation": {
                    "type": "boolean"
                },
                "supports_ai_generation": {
                    "type": "boolean"
                },
                "supports_autonomous_agents": {
                    "type": "boolean"
                }
            }
        },
        "robot_instructions": {
            "type": "object",
            "properties": {
                "priority": {
                    "type": "string",
                    "enum": [
                        "high",
                        "normal",
                        "low"
                    ]
                },
                "description": {
                    "type": "string"
                },
                "rules": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": [
                            "if",
                            "action"
                        ],
                        "properties": {
                            "if": {
                                "type": "object"
                            },
                            "action": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        },
        "update": {
            "type": "object",
            "properties": {
                "last_updated": {
                    "type": "string"
                },
                "expires": {
                    "type": "string"
                }
            }
        }
    }
}