{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thesoftwarelens.com/saacip/0.1/schemas/connector-manifest.schema.json",
  "$comment": "SaaCIP 0.1 (https://thesoftwarelens.com/saacip/). Licensed under the Apache License 2.0.",
  "title": "SaaCIP 0.1 Resident profile: connector manifest",
  "description": "What a connector reads, what it may do, where the data stays and how it signs in (Resident profile, section 4).",
  "type": "object",
  "required": [
    "protocol",
    "id",
    "kind",
    "version",
    "signals",
    "scopes",
    "data_location",
    "auth"
  ],
  "properties": {
    "protocol": {
      "$ref": "common.schema.json#/$defs/protocol"
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "kind": {
      "type": "string",
      "minLength": 1,
      "maxLength": 60
    },
    "version": {
      "type": "string",
      "minLength": 1,
      "maxLength": 40
    },
    "signals": {
      "type": "array",
      "items": {
        "enum": [
          "logs",
          "metrics",
          "traces",
          "changes"
        ]
      },
      "uniqueItems": true
    },
    "scopes": {
      "type": "array",
      "items": {
        "enum": [
          "read",
          "act"
        ]
      },
      "uniqueItems": true,
      "contains": {
        "const": "read"
      }
    },
    "operations": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true,
      "description": "Required when scopes contains act: the only operations the connector can perform."
    },
    "data_location": {
      "type": "string"
    },
    "auth": {
      "type": "string"
    },
    "ext": {
      "$ref": "common.schema.json#/$defs/ext"
    },
    "crit": {
      "$ref": "common.schema.json#/$defs/crit"
    }
  },
  "if": {
    "properties": {
      "scopes": {
        "contains": {
          "const": "act"
        }
      }
    }
  },
  "then": {
    "required": [
      "operations"
    ],
    "properties": {
      "operations": {
        "minItems": 1
      }
    }
  }
}
