{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Enable an aggregator for a community. Creates an authorization record in the community's repository. Requires moderator permissions.",
      "errors": [
        {
          "description": "Caller is not a moderator of this community",
          "name": "NotAuthorized"
        },
        {
          "description": "Aggregator DID does not exist or has no service declaration",
          "name": "AggregatorNotFound"
        },
        {
          "description": "Config does not match aggregator's configSchema",
          "name": "InvalidConfig"
        },
        {
          "description": "Aggregator is already enabled for this community",
          "name": "AlreadyEnabled"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "aggregatorDid": {
              "description": "DID of the aggregator to enable",
              "format": "did",
              "type": "string"
            },
            "community": {
              "description": "DID or handle of the community",
              "format": "at-identifier",
              "type": "string"
            },
            "config": {
              "description": "Aggregator-specific configuration. Must conform to the aggregator's configSchema.",
              "type": "unknown"
            }
          },
          "required": [
            "community",
            "aggregatorDid"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "authorization": {
              "description": "The created authorization details",
              "ref": "social.coves.aggregator.defs#authorizationView",
              "type": "ref"
            },
            "cid": {
              "description": "CID of the created authorization record",
              "format": "cid",
              "type": "string"
            },
            "uri": {
              "description": "AT-URI of the created authorization record",
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "uri",
            "cid",
            "authorization"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "social.coves.aggregator.enable",
  "lexicon": 1
}
