{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/bigKING67/pi-67/schemas/pi67-extension-registry.schema.json",
  "title": "pi-67 extension registry",
  "type": "object",
  "required": ["schema", "governance", "extensions"],
  "properties": {
    "schema": {
      "const": "pi67.extension-registry.v1"
    },
    "governance": {
      "type": "object",
      "required": ["defaultUserConfigPolicy", "forbiddenUpdateBehavior", "configPatchModes"],
      "properties": {
        "defaultUserConfigPolicy": {
          "type": "string",
          "minLength": 1
        },
        "forbiddenUpdateBehavior": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "configPatchModes": {
          "type": "array",
          "minItems": 1,
          "items": {
            "enum": ["merge-preserve", "template-only", "report-only"]
          }
        }
      },
      "additionalProperties": false
    },
    "extensions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "owner",
          "installStrategy",
          "updateStrategy",
          "repairStrategy",
          "configPatches",
          "smoke"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "type": "string",
            "minLength": 1
          },
          "owner": {
            "enum": ["pi67-managed", "external", "user-managed"]
          },
          "installStrategy": {
            "type": "string",
            "minLength": 1
          },
          "updateStrategy": {
            "type": "string",
            "minLength": 1
          },
          "repairStrategy": {
            "type": "string",
            "minLength": 1
          },
          "configPatches": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["file", "path", "mode"],
              "properties": {
                "file": {
                  "type": "string",
                  "minLength": 1
                },
                "path": {
                  "type": "string",
                  "minLength": 1
                },
                "mode": {
                  "enum": ["merge-preserve", "template-only", "report-only"]
                }
              },
              "additionalProperties": false
            }
          },
          "smoke": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "additionalProperties": true
      }
    }
  },
  "additionalProperties": false
}
