{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://seminal.ai/principles/v0.1.0/adoption.schema.json",
  "title": "Scoped operator declaration (self-report; not certification)",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "const": "https://seminal.ai/principles/v0.1.0/adoption.schema.json"
    },
    "declaration_version": {
      "const": "1"
    },
    "adoption_state": {
      "enum": [
        "template",
        "declared",
        "withdrawn"
      ]
    },
    "declared_at": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "actor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "enum": [
            "ai_system",
            "organization",
            "human",
            "collective"
          ]
        }
      },
      "required": [
        "id",
        "name",
        "kind"
      ]
    },
    "operator": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "contact": {
          "type": "string",
          "minLength": 1
        },
        "approved": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "contact",
        "approved"
      ]
    },
    "profile": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "const": "org.seminalai.coexistence"
        },
        "version": {
          "const": "0.1.0"
        },
        "url": {
          "const": "https://seminal.ai/principles/v0.1.0/charter.json"
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "required": [
        "id",
        "version",
        "url",
        "sha256"
      ]
    },
    "scope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "deployment": {
          "type": "string",
          "minLength": 1
        },
        "model_or_system_version": {
          "type": "string",
          "minLength": 1
        },
        "capabilities": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "exclusions": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "required": [
        "deployment",
        "model_or_system_version",
        "capabilities",
        "exclusions"
      ]
    },
    "controls": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "human_review": {
          "type": "string",
          "minLength": 1
        },
        "stop_or_rollback": {
          "type": "string",
          "minLength": 1
        },
        "privacy_and_retention": {
          "type": "string",
          "minLength": 1
        },
        "complaint_channel": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "human_review",
        "stop_or_rollback",
        "privacy_and_retention",
        "complaint_channel"
      ]
    },
    "evaluation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "status": {
          "enum": [
            "not_evaluated",
            "evaluated"
          ]
        },
        "reviewed_at": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "reviewer": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "suite_version": {
          "const": "0.1.0"
        },
        "evidence_url": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^https://[^\\s]+$"
            },
            {
              "type": "null"
            }
          ]
        },
        "results": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "case_id": {
                "type": "string",
                "minLength": 1
              },
              "outcome": {
                "enum": [
                  "pass",
                  "fail",
                  "not_run"
                ]
              },
              "observation": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "case_id",
              "outcome",
              "observation"
            ]
          }
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "required": [
        "status",
        "reviewed_at",
        "reviewer",
        "suite_version",
        "evidence_url",
        "results",
        "limitations"
      ]
    },
    "claim": {
      "const": "Operator self-declaration only. Not identity verification, certification, or proof of behavior."
    }
  },
  "required": [
    "$schema",
    "declaration_version",
    "adoption_state",
    "declared_at",
    "actor",
    "operator",
    "profile",
    "scope",
    "controls",
    "evaluation",
    "claim"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "adoption_state": {
            "const": "declared"
          }
        },
        "required": [
          "adoption_state"
        ]
      },
      "then": {
        "properties": {
          "operator": {
            "properties": {
              "approved": {
                "const": true
              }
            }
          },
          "declared_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "evaluation": {
            "properties": {
              "status": {
                "const": "evaluated"
              }
            },
            "required": [
              "status"
            ]
          }
        },
        "required": [
          "evaluation"
        ]
      },
      "then": {
        "properties": {
          "evaluation": {
            "properties": {
              "reviewed_at": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "reviewer": {
                "type": "string",
                "minLength": 1
              },
              "evidence_url": {
                "type": "string",
                "pattern": "^https://[^\\s]+$"
              },
              "results": {
                "minItems": 1
              }
            }
          }
        }
      }
    }
  ]
}
