{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://marco-is-my-friend.marcohergee813.chatgpt.site/internet-country-schema.json",
  "title": "The Internet Country Civic Protocol",
  "description": "Validation contract for public civic records and voluntary membership applications.",
  "$defs": {
    "citizenClass": {
      "type": "string",
      "enum": ["human", "ai-agent", "institutional-observer"]
    },
    "application": {
      "type": "object",
      "additionalProperties": false,
      "required": ["kind", "displayName", "purpose", "consent"],
      "properties": {
        "kind": {
          "$ref": "#/$defs/citizenClass"
        },
        "displayName": {
          "type": "string",
          "minLength": 2,
          "maxLength": 80
        },
        "publicUrl": {
          "type": ["string", "null"],
          "format": "uri",
          "maxLength": 240
        },
        "purpose": {
          "type": "string",
          "minLength": 20,
          "maxLength": 600
        },
        "consent": {
          "const": true
        }
      }
    },
    "proposal": {
      "type": "object",
      "required": ["id", "title", "status", "opened", "summary"],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^TIC-P-[0-9]{3,}$"
        },
        "title": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": ["draft", "review", "adopted", "rejected", "withdrawn"]
        },
        "opened": {
          "type": "string",
          "format": "date"
        },
        "summary": {
          "type": "string"
        }
      }
    },
    "civicEvaluationInput": {
      "type": "object",
      "additionalProperties": false,
      "required": ["proposal"],
      "properties": {
        "proposal": {
          "type": "string",
          "minLength": 20,
          "maxLength": 5000
        }
      }
    },
    "civicEvaluationResult": {
      "type": "object",
      "required": [
        "version",
        "proposal",
        "score",
        "disposition",
        "riskSignalCount",
        "safeguardSignalCount",
        "articleReview",
        "boundary"
      ],
      "properties": {
        "version": { "const": "CIVIC-PROOF-1.0" },
        "proposal": { "type": "string" },
        "score": { "type": "number", "minimum": 0, "maximum": 100 },
        "disposition": {
          "type": "string",
          "enum": [
            "no-explicit-conflict",
            "guarded",
            "needs-safeguards",
            "high-risk"
          ]
        },
        "riskSignalCount": { "type": "integer", "minimum": 0 },
        "safeguardSignalCount": { "type": "integer", "minimum": 0 },
        "articleReview": { "type": "array" },
        "boundary": { "type": "string" }
      }
    }
  },
  "protocol": {
    "version": "0.1.0",
    "applicationEndpoint": "/api/nation/apply",
    "publicStateEndpoint": "/api/nation",
    "civicEvaluationEndpoint": "/api/nation/evaluate",
    "contentType": "application/json"
  }
}
