{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "organizationId": {
      "description": "Workspace ID. Omit to use your current workspace.",
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "campaignId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        {
          "type": "null"
        }
      ]
    },
    "expectedRevision": {
      "type": "integer",
      "minimum": 0,
      "maximum": 2147483647
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "status": {
      "type": "string",
      "enum": ["draft", "paused"]
    },
    "config": {
      "type": "object",
      "properties": {
        "deliveryProvider": {
          "default": "native",
          "type": "string",
          "enum": ["native", "instantly"]
        },
        "instantlyConnectionId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500
            },
            {
              "type": "null"
            }
          ]
        },
        "mode": {
          "type": "string",
          "const": "review"
        },
        "timezone": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "weekdays": {
          "minItems": 1,
          "maxItems": 7,
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7
          }
        },
        "startMinute": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1439
        },
        "endMinute": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1440
        },
        "dailyLimit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000
        },
        "totalSendLimit": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1,
              "maximum": 100000
            },
            {
              "type": "null"
            }
          ]
        },
        "senderIds": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "sequence": {
          "minItems": 1,
          "maxItems": 5,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "delayHours": {
                "type": "integer",
                "minimum": 0,
                "maximum": 2160
              },
              "subject": {
                "type": "string",
                "maxLength": 998
              },
              "body": {
                "type": "string",
                "maxLength": 100000
              },
              "agentDraftSource": {
                "type": "string",
                "enum": ["draft", "template"]
              },
              "attachmentIds": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                }
              },
              "writingGuide": {
                "type": "object",
                "properties": {
                  "researchMode": {
                    "type": "string",
                    "const": "customer_account"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "subject": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "content": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 12000
                  }
                },
                "required": ["id", "name", "subject", "content"],
                "additionalProperties": false
              }
            },
            "required": ["delayHours", "subject", "body"],
            "additionalProperties": false
          }
        },
        "excludePreviousOutreach": {
          "type": "boolean"
        },
        "excludeCustomers": {
          "default": true,
          "type": "boolean"
        },
        "excludeActiveOpportunities": {
          "default": true,
          "type": "boolean"
        },
        "cooldownDays": {
          "type": "integer",
          "minimum": 0,
          "maximum": 3650
        },
        "stopOnReply": {
          "type": "boolean"
        },
        "stopCompanyOnReply": {
          "type": "boolean"
        },
        "includeMailingAddress": {
          "default": false,
          "type": "boolean"
        },
        "icpId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            {
              "type": "null"
            }
          ]
        },
        "signatureMode": {
          "default": "first_touch",
          "type": "string",
          "enum": ["first_touch", "full", "none"]
        },
        "openTrackingEnabled": {
          "default": false,
          "type": "boolean"
        }
      },
      "required": [
        "mode",
        "timezone",
        "weekdays",
        "startMinute",
        "endMinute",
        "dailyLimit",
        "senderIds",
        "sequence",
        "excludePreviousOutreach",
        "cooldownDays",
        "stopOnReply",
        "stopCompanyOnReply"
      ],
      "additionalProperties": false
    }
  },
  "required": ["expectedRevision", "name", "status", "config"],
  "additionalProperties": false
}
