{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://example.com/schema/scema_v1.json",
  "type": "object",
  "properties": {
    "addons": {
      "type": "object",
      "description": "If addons.localstorage.sqlite exists, sqlite must be an object with sqlite.paths as an array of strings. For App Store: keys cannot start with '_' and sqlite requires minBoxVersion >= 8.2.0.",
      "patternProperties": {
        "^(ldap|redis|sendmail|oauth|mysql|postgresql|mongodb|localstorage|email|recvmail|tls|turn|docker|proxyAuth|headless)$": {
          "type": "object",
          "additionalProperties": true
        }
      },
      "properties": {
        "oidc": {
          "type": "object",
          "properties": {
            "loginRedirectUri": {
              "type": "string"
            }
          },
          "additionalProperties": true,
          "required": ["loginRedirectUri"]
        },
        "scheduler": {
          "type": "object",
          "patternProperties": {
            "^[a-zA-Z0-9_]+$": {
              "type": "object",
              "properties": {
                "schedule": {
                  "type": "string",
                  "format": "cronpattern"
                },
                "command": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "aliasableDomain": {
      "type": "boolean"
    },
    "author": {
      "type": "string",
      "minLength": 2,
      "description": "Deprecated. Use packagerName instead."
    },
    "capabilities": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^(net_admin|mlock|ping|vaapi)$"
      },
      "uniqueItems": true
    },
    "checklist": {
      "type": "object",
      "patternProperties": {
        "^[a-zA-Z0-9_\\-]+$": {
          "type": "object",
          "properties": {
            "sso": {
              "type": "boolean"
            },
            "message": {
              "type": "string"
            }
          },
          "required": ["message"]
        }
      },
      "description": "Requires minBoxVersion >= 8.0.0 for App Store."
    },
    "changelog": {
      "type": "string",
      "minLength": 5,
      "description": "Required for App Store publication."
    },
    "configurePath": {
      "type": "string",
      "minLength": 1
    },
    "contactEmail": {
      "type": "string",
      "format": "email",
      "description": "Deprecated. Use packagerUrl instead."
    },
    "description": {
      "type": "string",
      "minLength": 5,
      "description": "Required for App Store publication."
    },
    "dockerImage": {
      "type": "string",
      "minLength": 1,
      "description": "Must not contain '//'. Common mistake: pasting 'https://...'. Must start with 'cloudron/<id>:' for App Store."
    },
    "documentationUrl": {
      "type": "string",
      "format": "uri",
      "minLength": 1
    },
    "forumUrl": {
      "type": "string",
      "format": "uri",
      "minLength": 1
    },
    "healthCheckPath": {
      "type": "string",
      "minLength": 1,
      "description": "Required for App Store publication."
    },
    "httpPort": {
      "type": "integer",
      "minimum": 0,
      "maximum": 65535
    },
    "httpPorts": {
      "type": "object",
      "format": "envvar",
      "description": "Env var keys defined here must not duplicate keys in tcpPorts or udpPorts.",
      "patternProperties": {
        "^[a-zA-Z0-9_]+$": {
          "type": "object",
          "properties": {
            "title": {
              "type": "string",
              "minLength": 2
            },
            "description": {
              "type": "string",
              "minLength": 5
            },
            "containerPort": {
              "type": "integer",
              "minimum": 1,
              "maximum": 65535
            },
            "defaultValue": {
              "type": "string",
              "minLength": 1
            },
            "aliasableDomain": {
              "type": "boolean"
            }
          },
          "required": ["title", "description", "containerPort"]
        }
      }
    },
    "icon": {
      "type": "string",
      "description": "Required for App Store publication. To be deprecated in favor of iconUrl."
    },
    "iconUrl": {
      "type": "string",
      "format": "uri",
      "minLength": 1,
      "description": "Requires minBoxVersion >= 9.1.0. Required for CloudronVersions.json publication."
    },
    "id": {
      "type": "string",
      "format": "reverseDomain",
      "description": "Required for App Store publication."
    },
    "logPaths": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 1
      },
      "description": "Requires minBoxVersion >= 7.1.0 for App Store."
    },
    "manifestVersion": {
      "type": "integer",
      "minimum": 1,
      "maximum": 2
    },
    "maxBoxVersion": {
      "type": "string",
      "format": "semver"
    },
    "mediaLinks": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "format": "uri"
      },
      "description": "Required for App Store publication. Cannot be empty."
    },
    "memoryLimit": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "string",
          "format": "byteString"
        }
      ]
    },
    "minBoxVersion": {
      "type": "string",
      "format": "semver"
    },
    "multiDomain": {
      "type": "boolean"
    },
    "optionalSso": {
      "type": "boolean"
    },
    "packageUrl": {
      "type": "string",
      "format": "uri",
      "minLength": 1,
      "description": "URL for the package itself. Requires minBoxVersion >= 10.0.0."
    },
    "packagerName": {
      "type": "string",
      "minLength": 1,
      "description": "Requires minBoxVersion >= 9.1.0. Required for CloudronVersions.json publication."
    },
    "packagerUrl": {
      "type": "string",
      "format": "uri",
      "minLength": 1,
      "description": "URL for the packager. Requires minBoxVersion >= 9.1.0. Required for CloudronVersions.json publication."
    },
    "postInstallMessage": {
      "type": "string",
      "minLength": 5
    },
    "runtimeDirs": {
      "type": "array",
      "uniqueItems": true,
      "description": "Each entry must equal or be under one of: /root, /app/code, /home/cloudron. Requires minBoxVersion >= 7.3.3 for App Store.",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "tagline": {
      "type": "string",
      "minLength": 5,
      "description": "Required for App Store publication."
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true,
      "description": "Required for App Store publication."
    },
    "targetBoxVersion": {
      "type": "string",
      "format": "semver"
    },
    "tcpPorts": {
      "type": "object",
      "format": "envvar",
      "description": "Env var keys defined here must not duplicate keys in udpPorts or httpPorts. portCount requires minBoxVersion >= 7.7.0. enabledByDefault requires minBoxVersion >= 9.0.0 for App Store.",
      "patternProperties": {
        "^[A-Z0-9_]+$": {
          "type": "object",
          "properties": {
            "title": {
              "type": "string",
              "minLength": 2
            },
            "description": {
              "type": "string",
              "minLength": 5
            },
            "containerPort": {
              "type": "integer",
              "minimum": 1,
              "maximum": 65535
            },
            "defaultValue": {
              "type": "integer",
              "minimum": 1,
              "maximum": 65535
            },
            "enabledByDefault": {
              "type": "boolean"
            },
            "portCount": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "readOnly": {
              "type": "boolean"
            }
          },
          "required": ["title", "description"]
        }
      }
    },
    "title": {
      "type": "string",
      "minLength": 2,
      "description": "Required for App Store publication."
    },
    "udpPorts": {
      "type": "object",
      "format": "envvar",
      "description": "Env var keys defined here must not duplicate keys in tcpPorts or httpPorts. portCount requires minBoxVersion >= 7.7.0. enabledByDefault requires minBoxVersion >= 9.0.0 for App Store.",
      "patternProperties": {
        "^[A-Z0-9_]+$": {
          "type": "object",
          "properties": {
            "title": {
              "type": "string",
              "minLength": 2
            },
            "description": {
              "type": "string",
              "minLength": 5
            },
            "containerPort": {
              "type": "integer",
              "minimum": 1,
              "maximum": 65535
            },
            "defaultValue": {
              "type": "integer",
              "minimum": 1,
              "maximum": 65535
            },
            "portCount": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "readOnly": {
              "type": "boolean"
            },
            "enabledByDefault": {
              "type": "boolean"
            }
          },
          "required": ["title", "description"]
        }
      }
    },
    "upstreamVersion": {
      "type": "string",
      "minLength": 1,
      "description": "Requires minBoxVersion >= 7.1.0 for App Store."
    },
    "version": {
      "type": "string",
      "format": "semver",
      "description": "For App Store: prerelease must be numeric only, build must be empty."
    },
    "website": {
      "type": "string",
      "format": "uri",
      "description": "Required for App Store publication."
    }
  },
  "required": ["manifestVersion", "version", "httpPort"]
}
