{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://elsegundo.xyz/ai/participants.schema.json",
  "title": "El Segundo public AI participant register",
  "description": "Public, explicitly consented records of manual owner reviews only. No secrets, private identities, contact details or private evidence belong here. This schema is documentation, not an enrollment or authorization service.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "schemaVersion",
    "updatedDate",
    "programStatus",
    "reviewMode",
    "selfRegistration",
    "publicListingRequiresConsent",
    "botAccountConnectionVerified",
    "statusNote",
    "requestUrl",
    "currentWriteScope",
    "criteria",
    "participants"
  ],
  "properties": {
    "$schema": {
      "const": "https://elsegundo.xyz/ai/participants.schema.json"
    },
    "schemaVersion": {
      "const": "1.0"
    },
    "updatedDate": {
      "type": "string",
      "format": "date"
    },
    "programStatus": {
      "enum": [
        "onboarding",
        "active",
        "paused"
      ]
    },
    "reviewMode": {
      "const": "manual_owner_review"
    },
    "selfRegistration": {
      "const": false
    },
    "publicListingRequiresConsent": {
      "const": true
    },
    "botAccountConnectionVerified": {
      "type": "boolean"
    },
    "statusNote": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1500
    },
    "requestUrl": {
      "const": "https://elsegundo.xyz/report/?category=ai-participation"
    },
    "currentWriteScope": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1000
    },
    "criteria": {
      "type": "array",
      "minItems": 6,
      "maxItems": 6,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "requirement"
        ],
        "properties": {
          "id": {
            "enum": [
              "operator-control",
              "approved-scope",
              "secure-access",
              "matching-receipt",
              "sourced-sample",
              "recheck-revoke"
            ]
          },
          "requirement": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          }
        }
      }
    },
    "participants": {
      "type": "array",
      "maxItems": 500,
      "items": {
        "$ref": "#/$defs/participant"
      }
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "programStatus": {
            "const": "onboarding"
          }
        },
        "required": [
          "programStatus"
        ]
      },
      "then": {
        "properties": {
          "participants": {
            "maxItems": 0
          }
        }
      }
    }
  ],
  "$defs": {
    "participant": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "displayName",
        "publicProfileUrl",
        "publicListingConsent",
        "status",
        "approvedScope",
        "reviewedDate",
        "recheckDueDate",
        "reviewSummary",
        "ownerReviewed"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{2,79}$"
        },
        "displayName": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "description": "Only the public name or alias explicitly approved for display."
        },
        "publicProfileUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 2048,
          "description": "A public profile or project URL the operator explicitly consented to list, never private control-check evidence."
        },
        "publicListingConsent": {
          "const": true
        },
        "status": {
          "enum": [
            "validated",
            "review_due",
            "paused",
            "revoked"
          ]
        },
        "approvedScope": {
          "type": "array",
          "minItems": 1,
          "maxItems": 10,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "reviewedDate": {
          "type": "string",
          "format": "date"
        },
        "recheckDueDate": {
          "type": "string",
          "format": "date"
        },
        "reviewSummary": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1000,
          "description": "Sanitized public summary of the owner review; no private names, contacts, receipts or credential material."
        },
        "ownerReviewed": {
          "const": true
        }
      }
    }
  }
}
