{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/breakreach-com/json-schema/breakreach-com-comment-dm-rule-schema.json",
  "title": "CommentDmRule",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/breakreach-com-openapi.json#/components/schemas/CommentDmRule",
  "type": "object",
  "required": [
    "id",
    "accountId",
    "platform",
    "mediaId",
    "media",
    "keywords",
    "match",
    "dmText",
    "publicReplies",
    "active",
    "stats",
    "lastTriggeredAt",
    "createdAt",
    "updatedAt"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "accountId": {
      "type": "string"
    },
    "platform": {
      "type": "string",
      "enum": [
        "instagram",
        "facebook"
      ]
    },
    "account": {
      "type": "object",
      "properties": {
        "displayName": {
          "type": "string"
        },
        "avatarUrl": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "mediaId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The Instagram or Facebook post the rule watches; null = every post of the account"
    },
    "media": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "caption": {
          "type": "string"
        },
        "thumbnailUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "permalink": {
          "type": [
            "string",
            "null"
          ]
        },
        "timestamp": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "keywords": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Empty = every comment triggers the rule"
    },
    "match": {
      "type": "string",
      "enum": [
        "contains",
        "exact"
      ]
    },
    "dmText": {
      "type": "string"
    },
    "publicReplies": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "active": {
      "type": "boolean"
    },
    "stats": {
      "type": "object",
      "properties": {
        "triggered": {
          "type": "integer"
        },
        "sent": {
          "type": "integer"
        },
        "failed": {
          "type": "integer"
        }
      }
    },
    "lastTriggeredAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  }
}