{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/coldrig-dev/json-schema/coldrig-dev-campaign-preview-schema.json",
  "title": "CampaignPreview",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/coldrig-dev-openapi.yml#/components/schemas/CampaignPreview",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "preview",
    "sendWindow",
    "timezone",
    "contacts",
    "suppressed",
    "duplicatesRemoved",
    "alreadyEmailed",
    "samples"
  ],
  "properties": {
    "preview": {
      "type": "boolean",
      "enum": [
        true
      ],
      "description": "Always true: nothing was created, scheduled or recorded."
    },
    "sendWindow": {
      "$ref": "#/$defs/ResolvedSendWindow"
    },
    "timezone": {
      "type": "string"
    },
    "contacts": {
      "type": "integer",
      "description": "Contacts a launch would store, after repeated addresses were collapsed."
    },
    "suppressed": {
      "type": "integer",
      "description": "Of those, how many are on your suppression list and would never be scheduled."
    },
    "duplicatesRemoved": {
      "type": "integer"
    },
    "alreadyEmailed": {
      "type": "integer",
      "description": "Contacts a launch would leave out because they already got this campaign's first email; never stored."
    },
    "endByShortfall": {
      "type": "integer",
      "description": "Only with an endBy: the same count the launch would carry."
    },
    "warning": {
      "type": "string",
      "description": "Only when the launch would carry one: the same sentence. Tell the person before they confirm."
    },
    "samples": {
      "type": "array",
      "description": "The first three contacts of the list, every step rendered for each, in list order.",
      "items": {
        "type": "object",
        "required": [
          "email",
          "steps"
        ],
        "properties": {
          "email": {
            "type": "string"
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "step",
                "subject",
                "body"
              ],
              "properties": {
                "step": {
                  "type": "integer"
                },
                "subject": {
                  "type": "string"
                },
                "body": {
                  "type": "string",
                  "description": "The step as rendered; every real send then appends the required footer."
                }
              }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "ResolvedSendWindow": {
      "type": "object",
      "description": "The send window that applied — the fields you sent, any you omitted filled from the default.",
      "required": [
        "startHour",
        "endHour",
        "days"
      ],
      "properties": {
        "startHour": {
          "type": "integer"
        },
        "endHour": {
          "type": "integer",
          "description": "Inclusive — the last hour a send may start in."
        },
        "days": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "description": "0 = Sunday … 6 = Saturday."
        }
      }
    }
  }
}