{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/deploy-wizard.schema.json",
  "title": "deploy-wizard manifest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "version",
    "profile",
    "project",
    "github",
    "registry",
    "compose",
    "deployment",
    "proxy"
  ],
  "properties": {
    "version": {
      "type": "integer",
      "const": 1
    },
    "profile": {
      "type": "string",
      "minLength": 1
    },
    "project": {
      "type": "object",
      "additionalProperties": false,
      "required": ["slug"],
      "properties": {
        "slug": {
          "type": "string",
          "minLength": 1
        },
        "displayName": {
          "type": "string"
        }
      }
    },
    "github": {
      "type": "object",
      "additionalProperties": false,
      "required": ["owner", "repo", "branch"],
      "properties": {
        "owner": {
          "type": "string",
          "minLength": 1
        },
        "repo": {
          "type": "string",
          "minLength": 1
        },
        "branch": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "registry": {
      "type": "object",
      "additionalProperties": false,
      "required": ["host", "image"],
      "properties": {
        "host": {
          "type": "string",
          "minLength": 1
        },
        "image": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "compose": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sourceFiles",
        "managedServices",
        "publicService",
        "publicContainerPort"
      ],
      "properties": {
        "sourceFiles": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "managedServices": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "publicService": {
          "type": "string",
          "minLength": 1
        },
        "publicContainerPort": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "deployment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "composeFileName",
        "proxyFileName",
        "remoteEnvFile",
        "localEnvTemplate",
        "localEnvFile",
        "publishedPort"
      ],
      "properties": {
        "composeFileName": {
          "type": "string",
          "minLength": 1
        },
        "proxyFileName": {
          "type": "string",
          "minLength": 1
        },
        "remoteEnvFile": {
          "type": "string",
          "minLength": 1
        },
        "localEnvTemplate": {
          "type": "string",
          "minLength": 1
        },
        "localEnvFile": {
          "type": "string",
          "minLength": 1
        },
        "publishedPort": {
          "type": "integer",
          "minimum": 1
        },
        "backendHost": {
          "type": "string"
        }
      }
    },
    "serviceOverrides": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "imageName": {
            "type": "string"
          },
          "useEnvFile": {
            "type": "boolean"
          },
          "restart": {
            "type": "string"
          },
          "publishedPort": {
            "type": "integer",
            "minimum": 1
          },
          "extraVolumes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dataMounts": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": ["hostSubpath", "containerPath"],
              "properties": {
                "hostSubpath": {
                  "type": "string",
                  "minLength": 1
                },
                "containerPath": {
                  "type": "string",
                  "minLength": 1
                },
                "readOnly": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      }
    },
    "proxy": {
      "type": "object",
      "additionalProperties": false,
      "required": ["routes"],
      "properties": {
        "routes": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["name", "hosts", "entryPoints", "tls"],
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1
              },
              "hosts": {
                "type": "array",
                "minItems": 1,
                "description": "Hostnames for the route. In trm-api proxy mode, this must contain exactly one host.",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "pathPrefix": {
                "type": "string",
                "description": "Optional PathPrefix rule segment. Not supported in trm-api proxy mode."
              },
              "entryPoints": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "tls": {
                "type": "boolean"
              },
              "scheme": {
                "type": "string",
                "enum": ["http", "https"]
              }
            }
          }
        }
      }
    }
  }
}
