{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ploid/json-schema/ploid-monitor-update-request-schema.json",
  "title": "MonitorUpdateRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ploid-monitors-api-openapi.yml#/components/schemas/MonitorUpdateRequest",
  "type": "object",
  "minProperties": 1,
  "properties": {
    "name": {
      "type": "string",
      "maxLength": 120
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "paused"
      ]
    },
    "query": {
      "type": "string",
      "maxLength": 1000
    },
    "schedule": {
      "$ref": "#/$defs/MonitorSchedule"
    },
    "output": {
      "$ref": "#/$defs/MonitorOutput"
    },
    "plan": {
      "$ref": "#/$defs/MonitorPlan"
    },
    "webhook_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "max_items_per_run": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    }
  },
  "$defs": {
    "MonitorOutput": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "text",
            "object"
          ],
          "description": "`text` returns `{ summary }` per item. `object` returns the schema you give or one derived from the query."
        },
        "schema": {
          "type": "object",
          "additionalProperties": true,
          "description": "JSON Schema with an object root, at most 25 properties."
        },
        "description": {
          "type": "string",
          "description": "Describe the fields in prose, or paste example JSON or a JSON Schema, to derive `schema`."
        }
      }
    },
    "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."
        }
      }
    },
    "MonitorSchedule": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "preset"
          ],
          "additionalProperties": false,
          "properties": {
            "preset": {
              "type": "string",
              "enum": [
                "hourly",
                "daily",
                "weekly"
              ]
            },
            "timezone": {
              "type": "string",
              "default": "UTC"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "cron"
          ],
          "additionalProperties": false,
          "properties": {
            "cron": {
              "type": "string",
              "description": "Five-field cron. The minute field must be a single value, so runs happen at most hourly."
            },
            "timezone": {
              "type": "string",
              "default": "UTC"
            }
          }
        }
      ]
    },
    "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."
        }
      }
    }
  }
}