{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ploid/json-schema/ploid-monitor-compilation-schema.json",
  "title": "MonitorCompilation",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ploid-monitors-api-openapi.yml#/components/schemas/MonitorCompilation",
  "type": "object",
  "required": [
    "object",
    "name",
    "plan",
    "output",
    "unresolved"
  ],
  "properties": {
    "object": {
      "type": "string",
      "const": "monitor_compilation"
    },
    "name": {
      "type": "string"
    },
    "plan": {
      "$ref": "#/$defs/MonitorPlan"
    },
    "output": {
      "type": "object",
      "required": [
        "type",
        "schema"
      ],
      "properties": {
        "type": {
          "type": "string"
        },
        "schema": {
          "type": "object",
          "additionalProperties": true
        }
      }
    },
    "unresolved": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "platform": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "mention": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        }
      }
    }
  },
  "$defs": {
    "MonitorPlan": {
      "type": "object",
      "required": [
        "targets"
      ],
      "properties": {
        "targets": {
          "type": "array",
          "minItems": 1,
          "maxItems": 10,
          "items": {
            "$ref": "#/$defs/MonitorTarget"
          }
        },
        "relevance_criteria": {
          "type": [
            "string",
            "null"
          ],
          "description": "Every item must satisfy this to be emitted. Null emits all new activity."
        }
      }
    },
    "MonitorTarget": {
      "type": "object",
      "required": [
        "platform",
        "kind",
        "identifier"
      ],
      "properties": {
        "platform": {
          "type": "string",
          "enum": [
            "linkedin",
            "x",
            "instagram",
            "tiktok"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "profile",
            "company",
            "keyword",
            "hashtag"
          ],
          "description": "`company` is LinkedIn-only; elsewhere brand accounts are profiles."
        },
        "identifier": {
          "type": "string",
          "description": "Profile or company URL or @handle; search terms for keyword; tag without # for hashtag. Instagram supports hashtags but not keyword search."
        },
        "events": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "posts",
              "engagement",
              "profile",
              "company"
            ]
          },
          "description": "Defaults to posts. Topics support posts only."
        }
      }
    }
  }
}