{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://encodeapi.com/assets/examples/encoding-job.schema.json",
  "title": "EncodeAPI.com illustrative encoding job",
  "description": "Reference design only. Not a hosted API contract. Semantic authorization and asset checks belong to the implementing application.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "source_asset",
    "operation",
    "profile",
    "require_review"
  ],
  "properties": {
    "schema_version": {
      "const": "1.0"
    },
    "source_asset": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]{2,79}$"
    },
    "operation": {
      "enum": [
        "video",
        "audio",
        "clip"
      ]
    },
    "profile": {
      "enum": [
        "web-review-v1",
        "speech-review-v1",
        "vertical-clip-v1"
      ]
    },
    "interval": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "start_seconds",
        "duration_seconds"
      ],
      "properties": {
        "start_seconds": {
          "type": "number",
          "minimum": 0
        },
        "duration_seconds": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      }
    },
    "require_review": {
      "const": true
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "operation": {
            "const": "clip"
          }
        }
      },
      "then": {
        "required": [
          "interval"
        ],
        "properties": {
          "profile": {
            "const": "vertical-clip-v1"
          }
        }
      },
      "else": {
        "not": {
          "required": [
            "interval"
          ]
        }
      }
    },
    {
      "if": {
        "properties": {
          "operation": {
            "const": "video"
          }
        }
      },
      "then": {
        "properties": {
          "profile": {
            "const": "web-review-v1"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "operation": {
            "const": "audio"
          }
        }
      },
      "then": {
        "properties": {
          "profile": {
            "const": "speech-review-v1"
          }
        }
      }
    }
  ]
}
