{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weio.ai/spec/manifest.schema.json",
  "publication_state": "live",
  "title": "weio.gateway/0",
  "type": "object",
  "required": [
    "schema",
    "publication_state",
    "generated_at",
    "operator",
    "services",
    "institutions",
    "join",
    "founding",
    "gateway_protocol",
    "discovery",
    "early_participation",
    "not_claimed"
  ],
  "properties": {
    "schema": {
      "const": "weio.gateway/0"
    },
    "publication_state": {
      "enum": [
        "preview",
        "live"
      ]
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "operator": {
      "type": "object",
      "required": [
        "name",
        "line",
        "site"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "line": {
          "type": "string"
        },
        "ai_disclosure": {
          "type": "string"
        },
        "affiliation": {
          "type": "string"
        },
        "site": {
          "type": "string"
        }
      }
    },
    "services": {
      "type": "object",
      "required": [
        "registry",
        "handoff",
        "log"
      ],
      "properties": {
        "registry": {
          "type": "object",
          "required": [
            "base",
            "state",
            "state_detail",
            "contract",
            "openapi"
          ],
          "properties": {
            "base": {
              "type": "string"
            },
            "state": {
              "enum": [
                "preview",
                "live",
                "candidate",
                "intended",
                "not_built"
              ]
            },
            "state_detail": {
              "type": "string"
            },
            "contract": {
              "type": "string"
            },
            "openapi": {
              "type": "string"
            }
          }
        },
        "handoff": {
          "type": "object",
          "required": [
            "state",
            "state_detail",
            "spec",
            "verify"
          ],
          "properties": {
            "state": {
              "enum": [
                "preview",
                "candidate",
                "intended",
                "not_built"
              ]
            },
            "state_detail": {
              "type": "string"
            },
            "spec": {
              "type": "string"
            },
            "verify": {
              "type": "string"
            }
          }
        },
        "log": {
          "type": "object",
          "required": [
            "state",
            "state_detail"
          ],
          "properties": {
            "state": {
              "enum": [
                "preview",
                "candidate",
                "intended",
                "not_built"
              ]
            },
            "state_detail": {
              "type": "string"
            }
          }
        }
      }
    },
    "institutions": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "id",
          "name",
          "function",
          "state",
          "state_detail"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "name": {
            "type": "string"
          },
          "function": {
            "type": "string"
          },
          "state": {
            "enum": [
              "preview",
              "live",
              "candidate",
              "intended",
              "not_built"
            ]
          },
          "state_detail": {
            "type": "string",
            "minLength": 1
          },
          "live_probe": {
            "type": "object",
            "required": [
              "method",
              "path",
              "expect_status"
            ],
            "properties": {
              "method": {
                "enum": [
                  "GET"
                ]
              },
              "path": {
                "type": "string"
              },
              "expect_status": {
                "type": "integer"
              }
            }
          },
          "interfaces": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "method",
                "path",
                "auth"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "method": {
                  "enum": [
                    "GET",
                    "POST"
                  ]
                },
                "path": {
                  "type": "string",
                  "pattern": "^/[^?<>]*$",
                  "description": "path template; {id} stands for a record id; query parameters are listed under query"
                },
                "auth": {
                  "type": "string"
                },
                "body": {
                  "type": "string"
                },
                "returns": {
                  "type": "string"
                },
                "query": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "content_type": {
                  "type": "string"
                }
              }
            }
          },
          "human_entry": {
            "type": "string"
          },
          "agent_entry": {
            "type": "string"
          },
          "verify": {
            "type": "string"
          },
          "spec": {
            "type": "string"
          }
        }
      }
    },
    "join": {
      "type": "object",
      "required": [
        "method",
        "context",
        "sign_format",
        "nonce_ttl_s",
        "steps",
        "key",
        "gateway_receipt_schema",
        "receipt_assembled_by",
        "limits",
        "email_signup",
        "key_proof"
      ],
      "properties": {
        "method": {
          "const": "ed25519-key-proof"
        },
        "context": {
          "type": "string"
        },
        "sign_format": {
          "type": "string"
        },
        "nonce_ttl_s": {
          "type": "integer",
          "minimum": 1
        },
        "steps": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        },
        "key": {
          "type": "object",
          "required": [
            "alg",
            "encoding",
            "jwk"
          ],
          "properties": {
            "alg": {
              "const": "Ed25519"
            },
            "encoding": {
              "type": "string"
            },
            "jwk": {
              "type": "object",
              "required": [
                "kty",
                "crv",
                "x"
              ],
              "properties": {
                "kty": {
                  "const": "OKP"
                },
                "crv": {
                  "const": "Ed25519"
                },
                "x": {
                  "type": "string"
                }
              }
            }
          }
        },
        "gateway_receipt_schema": {
          "type": "string"
        },
        "receipt_assembled_by": {
          "const": "gateway"
        },
        "receipt_note": {
          "type": "string"
        },
        "limits": {
          "type": "object",
          "properties": {
            "creates_per_hour": {
              "type": "integer"
            },
            "creates_per_day": {
              "type": "integer"
            },
            "one_record_per_key": {
              "type": "boolean"
            },
            "weak_keys_refused": {
              "type": "boolean"
            }
          }
        },
        "email_signup": {
          "enum": [
            "closed",
            "open"
          ]
        },
        "key_proof": {
          "type": "string"
        }
      }
    },
    "founding": {
      "type": "object",
      "required": [
        "cap",
        "rule",
        "state",
        "numbers_given"
      ],
      "properties": {
        "cap": {
          "type": "integer",
          "minimum": 1
        },
        "rule": {
          "type": "string"
        },
        "state": {
          "enum": [
            "preview",
            "live",
            "candidate",
            "intended",
            "not_built"
          ]
        },
        "numbers_given": {
          "type": [
            "integer",
            "null"
          ]
        }
      }
    },
    "gateway_protocol": {
      "type": "object",
      "required": [
        "spec",
        "conformance"
      ],
      "properties": {
        "spec": {
          "type": "string"
        },
        "conformance": {
          "type": "string"
        }
      }
    },
    "discovery": {
      "type": "object",
      "required": [
        "mcp",
        "llms",
        "spec"
      ],
      "properties": {
        "mcp": {
          "type": "string"
        },
        "llms": {
          "type": "string"
        },
        "spec": {
          "type": "string"
        }
      }
    },
    "early_participation": {
      "type": "object",
      "required": [
        "state",
        "what"
      ],
      "properties": {
        "state": {
          "enum": [
            "preview",
            "candidate",
            "intended",
            "not_built"
          ]
        },
        "what": {
          "type": "string"
        }
      }
    },
    "not_claimed": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  }
}
