{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ploid/json-schema/ploid-monitor-schema.json",
  "title": "Monitor",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ploid-monitors-api-openapi.yml#/components/schemas/Monitor",
  "type": "object",
  "properties": {
    "object": {
      "type": "string",
      "const": "monitor"
    },
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "query": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "paused",
        "disabled"
      ]
    },
    "schedule": {
      "type": "object",
      "properties": {
        "preset": {
          "type": [
            "string",
            "null"
          ]
        },
        "cron": {
          "type": "string"
        },
        "timezone": {
          "type": "string"
        }
      }
    },
    "targets": {
      "type": "array",
      "items": {
        "allOf": [
          {
            "$ref": "#/$defs/MonitorTarget"
          },
          {
            "properties": {
              "id": {
                "type": "string"
              }
            }
          }
        ]
      }
    },
    "relevance_criteria": {
      "type": [
        "string",
        "null"
      ]
    },
    "output": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        },
        "schema": {
          "type": "object",
          "additionalProperties": true
        }
      }
    },
    "webhook_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "max_items_per_run": {
      "type": "integer"
    },
    "baseline_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "last_run_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "next_run_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "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."
        }
      }
    }
  }
}