{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/neuron-ng/json-schema/neuron-ng-bot-task-schema.json",
  "title": "BotTask",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/neuron-ng-openapi.json#/components/schemas/BotTask",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "orgId": {
      "type": "string",
      "format": "uuid"
    },
    "botId": {
      "type": "string",
      "format": "uuid"
    },
    "title": {
      "type": "string"
    },
    "instruction": {
      "type": "string"
    },
    "scheduleKind": {
      "type": "string",
      "enum": [
        "cron",
        "interval",
        "once",
        "manual"
      ]
    },
    "schedule": {
      "type": "object",
      "description": "cron: {time:'HH:MM', days?:number[] (0=Sun..6=Sat, empty=every day)}; interval: {everyMinutes:number}; once: {runAt:ISO8601}; manual: {}"
    },
    "timezone": {
      "type": "string",
      "description": "IANA timezone, e.g. Africa/Lagos"
    },
    "enabled": {
      "type": "boolean"
    },
    "source": {
      "type": "string",
      "enum": [
        "user",
        "bot"
      ],
      "description": "'bot' = the bot created this task for itself"
    },
    "config": {
      "type": "object",
      "properties": {
        "channelId": {
          "type": "string",
          "format": "uuid"
        },
        "maxActions": {
          "type": "integer"
        },
        "noRepeatDays": {
          "type": "integer"
        },
        "requiresApproval": {
          "type": "boolean"
        },
        "approvalPhone": {
          "type": "string"
        },
        "dryRun": {
          "type": "boolean"
        }
      }
    },
    "state": {
      "type": "object"
    },
    "lastRunAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "nextRunAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "runCount": {
      "type": "integer"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  }
}