{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dpf-it-com/json-schema/dpf-it-com-create-trigger-request-schema.json",
  "title": "CreateTriggerRequest",
  "description": "`connectionId`/`frequency` are required when `type` is `sftp`/`aws_s3` (the\ndefault). `upstreamSpecName` is required instead when `type` is\n`spec_success`. `frequency` is required instead when `type` is `schedule`\n(no connection or upstream spec). Both `spec_success` and `schedule` require\nthe downstream spec (`specName`) to already be a table-source\n(`sourceType: 'tables'`) or compaction (`sourceType: 'compaction'`) spec.\n",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dpf-it-com-job-triggers-api-openapi.yml#/components/schemas/CreateTriggerRequest",
  "type": "object",
  "required": [
    "action",
    "workspaceId",
    "specName"
  ],
  "properties": {
    "action": {
      "type": "string",
      "enum": [
        "create-trigger"
      ]
    },
    "workspaceId": {
      "type": "string",
      "format": "uuid"
    },
    "type": {
      "type": "string",
      "enum": [
        "sftp",
        "aws_s3",
        "spec_success",
        "schedule"
      ],
      "description": "Defaults to \"sftp\". For sftp/aws_s3 must match the referenced connection's type."
    },
    "specName": {
      "type": "string",
      "description": "The (downstream) spec this trigger fires."
    },
    "connectionId": {
      "type": "string",
      "format": "uuid",
      "description": "Required when type is \"sftp\" or \"aws_s3\"."
    },
    "s3Bucket": {
      "type": "string",
      "description": "Required when type is \"aws_s3\". The bucket this trigger polls."
    },
    "s3Prefix": {
      "type": "string",
      "description": "Optional when type is \"aws_s3\"; defaults to the whole bucket. Ignored otherwise."
    },
    "frequency": {
      "allOf": [
        {
          "$ref": "#/$defs/TriggerFrequency"
        }
      ],
      "description": "Required when type is \"sftp\", \"aws_s3\", or \"schedule\". Not applicable to spec_success."
    },
    "upstreamSpecName": {
      "type": "string",
      "description": "Required when type is \"spec_success\" — the spec whose successful job completion fires this trigger."
    },
    "preRules": {
      "type": "string"
    },
    "postRules": {
      "type": "string"
    },
    "dedupe": {
      "type": "boolean",
      "description": "Defaults to false."
    },
    "enabled": {
      "type": "boolean",
      "description": "Defaults to true."
    }
  },
  "$defs": {
    "TriggerFrequency": {
      "type": "object",
      "description": "Polling cadence, evaluated in UTC by the hourly dispatcher.\n`hourOfDay` is required for `daily`/`monthly`; `dayOfMonth` for `monthly`.\n",
      "required": [
        "unit"
      ],
      "properties": {
        "unit": {
          "type": "string",
          "enum": [
            "hourly",
            "daily",
            "monthly"
          ]
        },
        "hourOfDay": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23,
          "description": "Hour of day (UTC). Required for daily and monthly."
        },
        "dayOfMonth": {
          "type": "integer",
          "minimum": 1,
          "maximum": 31,
          "description": "Day of month. Required for monthly."
        }
      }
    }
  }
}