{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/Sharathvc23/forgetproof/main/schemas/forget-me/v1/discovery.schema.json",
  "title": "ForgetMe v1: the discovery fragment in /.well-known/poppy.json",
  "description": "What a Company adds to its existing Poppy discovery document to say it speaks ForgetMe v1. The schema checks only the fragment this extension owns: `extensions[\"stellarminds.ai/forget-me\"]`. Everything else in the document belongs to Poppy and is left alone. Nothing here may be tenant-specific. A Company that serves ForgetMe over Poppy also lists `operations` (version 3) there: that is the approval exchange a withdrawal goes through.",
  "type": "object",
  "properties": {
    "extensions": {
      "type": "object",
      "properties": {
        "stellarminds.ai/forget-me": {
          "description": "One entry per major version the Company serves. Clients pick the entry whose version they speak.",
          "type": "array",
          "minItems": 1,
          "maxItems": 8,
          "items": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "pattern": "^[1-9][0-9]*$"
              },
              "endpoint": {
                "description": "The v1 base. Every route derives from it: {endpoint}/preview, {endpoint}/submit, {endpoint}/operations/{id}, {endpoint}/operations/{id}/evidence; GET {endpoint} is the index with the issuer's keys. An absolute https URL, or a path on the document's own origin.",
                "type": "string",
                "minLength": 1,
                "maxLength": 2048,
                "pattern": "^(https://[^\\s?#]+|/[^\\s?#]*)$"
              },
              "scopes": {
                "description": "The Company's OAuth scope names (Poppy 1.0 section 4.7: each Company defines its own) that this extension's two request scopes need: `item` for a withdrawal by reference, `account` for everything the Company holds for the account. Optional; a 401 challenge names the scope too.",
                "type": "object",
                "properties": {
                  "item": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "account": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "item",
                  "account"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "version",
              "endpoint"
            ],
            "additionalProperties": true
          }
        }
      },
      "required": [
        "stellarminds.ai/forget-me"
      ],
      "additionalProperties": true
    }
  },
  "required": [
    "extensions"
  ],
  "additionalProperties": true,
  "examples": [
    {
      "extensions": {
        "stellarminds.ai/forget-me": [
          {
            "version": "1",
            "endpoint": "https://company.example/forget-me/v1"
          }
        ]
      }
    }
  ]
}
