{
  "meta:license": [
    "Copyright 2023 Adobe. All rights reserved.",
    "This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
    "you may not use this file except in compliance with the License. You may obtain a copy",
    "of the License at http://www.apache.org/licenses/LICENSE-2.0",
    "",
    "Unless required by applicable law or agreed to in writing, software distributed under",
    "the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
    "OF ANY KIND, either express or implied. See the License for the specific language",
    "governing permissions and limitations under the License."
  ],
  "$id": "https://ns.adobe.com/helix/config/cdn",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$defs": {
    "stringOrArray": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ]
    }
  },
  "title": "ProjectCDNConfig",
  "type": "object",
  "properties": {
    "prod": {
      "oneOf": [{
        "type": "object",
        "title": "FastlyConfig",
        "description": "Production CDN configuration for Fastly",
        "properties": {
          "type": {
            "type": "string",
            "const": "fastly"
          },
          "host": {
            "description": "production host",
            "type": "string"
          },
          "route": {
            "description": "Route or routes on the CDN that are rendered with Franklin",
            "$ref": "#/$defs/stringOrArray"
          },
          "serviceId": {
            "description": "The Fastly Service ID",
            "type": "string"
          },
          "authToken": {
            "description": "A Fastly token for purging",
            "type": "string"
          }
        },
        "required": ["type", "host", "route", "serviceId", "authToken"],
        "additionalProperties": false
      }, {
        "type": "object",
        "title": "AkamaiConfig",
        "properties": {
          "type": {
            "type": "string",
            "const": "akamai"
          },
          "host": {
            "description": "production host",
            "type": "string"
          },
          "route": {
            "description": "Route or routes on the CDN that are rendered with Franklin",
            "$ref": "#/$defs/stringOrArray"
          },
          "endpoint": {
            "type": "string"
          },
          "clientSecret": {
            "type": "string"
          },
          "clientToken": {
            "type": "string"
          },
          "accessToken": {
            "type": "string"
          }
        },
        "required": ["type", "host", "route", "endpoint", "clientSecret", "clientToken", "accessToken"],
        "additionalProperties": false
      }, {
        "type": "object",
        "title": "CloudflareConfig",
        "properties": {
          "type": {
            "type": "string",
            "const": "cloudflare"
          },
          "host": {
            "description": "production host",
            "type": "string"
          },
          "route": {
            "description": "Route or routes on the CDN that are rendered with Franklin",
            "$ref": "#/$defs/stringOrArray"
          },
          "origin": {
            "type": "string"
          },
          "plan": {
            "type": "string"
          },
          "zoneId": {
            "type": "string"
          },
          "apiToken": {
            "type": "string"
          }
        },
        "required": ["type", "host", "route", "origin", "plan", "zoneId", "apiToken"],
        "additionalProperties": false
      }, {
        "type": "object",
        "title": "ManagedConfig",
        "properties": {
          "type": {
            "type": "string",
            "const": "managed"
          },
          "host": {
            "description": "production host",
            "type": "string"
          },
          "route": {
            "description": "Route or routes on the CDN that are rendered with Franklin",
            "$ref": "#/$defs/stringOrArray"
          }
        },
        "required": [ "type", "host", "route"],
        "additionalProperties": false
      }]
    },
    "live": {
      "properties": {
        "host": {
          "description": "Sidekick config to override the default preview host. it supports parameters $owner and $repo",
          "examples": ["main--$repo--page.example.com"],
          "type": "string"
        }
      },
      "required": ["host"],
      "additionalProperties": false
    },
    "preview": {
      "properties": {
        "host": {
          "description": "Sidekick config to override the default live host. it supports parameters $owner and $repo",
          "examples": ["main--$repo--live.example.com\""],
          "type": "string"
        }
      },
      "required": ["host"],
      "additionalProperties": false
    }
  },
  "required": ["prod"],
  "additionalProperties": false
}
