{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "jobs": {
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": { "type": "string", "pattern": "^[a-z][a-z0-9-]{0,62}$" },
          "description": { "type": "string", "maxLength": 500 },
          "command": {
            "minItems": 1,
            "maxItems": 64,
            "type": "array",
            "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
          },
          "schedule": {
            "type": "object",
            "properties": {
              "cron": { "type": "string", "minLength": 1, "maxLength": 120 },
              "timezone": { "default": "UTC", "type": "string", "const": "UTC" }
            },
            "required": ["cron"],
            "additionalProperties": false
          },
          "timeoutSeconds": {
            "default": 300,
            "type": "integer",
            "minimum": 5,
            "maximum": 3600
          },
          "enabled": { "default": true, "type": "boolean" }
        },
        "required": ["name", "command", "schedule"],
        "additionalProperties": false
      }
    },
    "logDrains": {
      "maxItems": 6,
      "type": "array",
      "items": {
        "type": "string",
        "enum": ["newrelic", "axiom", "betterstack", "datadog", "otlp", "loki"]
      }
    },
    "autoDeploy": {
      "anyOf": [
        { "type": "boolean" },
        {
          "type": "object",
          "properties": {
            "inputs": {
              "minItems": 1,
              "maxItems": 200,
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 1024 }
            }
          },
          "required": ["inputs"],
          "additionalProperties": false
        }
      ]
    },
    "vulnerabilityScanning": { "type": "boolean" },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$"
    },
    "name": { "type": "string", "minLength": 1, "maxLength": 120 },
    "description": { "type": "string", "maxLength": 500 },
    "server": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string"
    },
    "deployment": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "type": { "type": "string", "const": "dockerfile" },
            "context": {
              "default": ".",
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "arguments": {
              "default": {},
              "type": "object",
              "propertyNames": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "additionalProperties": { "type": "string", "maxLength": 4096 }
            },
            "resources": {
              "default": { "cpus": 2, "memory": "2g" },
              "type": "object",
              "properties": {
                "cpus": {
                  "default": 2,
                  "type": "number",
                  "exclusiveMinimum": 0,
                  "maximum": 128
                },
                "memory": {
                  "default": "2g",
                  "type": "string",
                  "pattern": "^\\d+(?:\\.\\d+)?(?:[kmgt]i?b?|b)$"
                }
              },
              "additionalProperties": false
            },
            "dockerfile": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "target": { "type": "string", "minLength": 1, "maxLength": 128 },
            "architecture": { "type": "string", "enum": ["amd64", "arm64"] },
            "cache": {
              "type": "object",
              "properties": {
                "enabled": { "default": true, "type": "boolean" },
                "scope": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9])?$"
                }
              },
              "additionalProperties": false
            },
            "timeoutSeconds": {
              "default": 2700,
              "type": "integer",
              "minimum": 60,
              "maximum": 7200
            }
          },
          "required": ["type", "dockerfile"],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": { "type": "string", "const": "static" },
            "context": {
              "default": ".",
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "arguments": {
              "default": {},
              "type": "object",
              "propertyNames": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "additionalProperties": { "type": "string", "maxLength": 4096 }
            },
            "resources": {
              "default": { "cpus": 2, "memory": "2g" },
              "type": "object",
              "properties": {
                "cpus": {
                  "default": 2,
                  "type": "number",
                  "exclusiveMinimum": 0,
                  "maximum": 128
                },
                "memory": {
                  "default": "2g",
                  "type": "string",
                  "pattern": "^\\d+(?:\\.\\d+)?(?:[kmgt]i?b?|b)$"
                }
              },
              "additionalProperties": false
            },
            "output": { "type": "string", "minLength": 1, "maxLength": 1024 },
            "buildCommand": {
              "minItems": 1,
              "maxItems": 64,
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
            },
            "architecture": { "type": "string", "enum": ["amd64", "arm64"] },
            "cache": {
              "type": "object",
              "properties": {
                "enabled": { "default": true, "type": "boolean" },
                "scope": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9])?$"
                }
              },
              "additionalProperties": false
            },
            "nodeImage": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
            },
            "runtimeImage": {
              "default": "nginxinc/nginx-unprivileged@sha256:0c79d56aee561a1d81c63f00eee5fb5fe29279560cdc55e91425133104c7fbe6",
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
            },
            "spaFallback": { "default": false, "type": "boolean" },
            "index": {
              "default": "index.html",
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "errorPage": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "headers": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
              },
              "additionalProperties": { "type": "string", "maxLength": 2048 }
            },
            "timeoutSeconds": {
              "default": 1800,
              "type": "integer",
              "minimum": 60,
              "maximum": 7200
            }
          },
          "required": ["type", "output", "nodeImage"],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": { "type": "string", "const": "image" },
            "image": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\s@]+(?:@sha256:[a-f0-9]{64})?$"
            },
            "registry": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
            },
            "platform": {
              "type": "string",
              "enum": ["linux/amd64", "linux/arm64"]
            },
            "pullPolicy": {
              "default": "if-not-present",
              "type": "string",
              "enum": ["if-not-present", "always"]
            }
          },
          "required": ["type", "image"],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": { "type": "string", "const": "railpack" },
            "context": {
              "default": ".",
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "arguments": {
              "default": {},
              "type": "object",
              "propertyNames": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "additionalProperties": { "type": "string", "maxLength": 4096 }
            },
            "resources": {
              "default": { "cpus": 2, "memory": "2g" },
              "type": "object",
              "properties": {
                "cpus": {
                  "default": 2,
                  "type": "number",
                  "exclusiveMinimum": 0,
                  "maximum": 128
                },
                "memory": {
                  "default": "2g",
                  "type": "string",
                  "pattern": "^\\d+(?:\\.\\d+)?(?:[kmgt]i?b?|b)$"
                }
              },
              "additionalProperties": false
            },
            "buildCommand": {
              "minItems": 1,
              "maxItems": 64,
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
            },
            "startCommand": {
              "minItems": 1,
              "maxItems": 64,
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
            },
            "configFile": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "architecture": { "type": "string", "enum": ["amd64", "arm64"] },
            "timeoutSeconds": {
              "default": 2700,
              "type": "integer",
              "minimum": 60,
              "maximum": 7200
            },
            "cache": {
              "type": "object",
              "properties": {
                "enabled": { "default": true, "type": "boolean" },
                "scope": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9])?$"
                }
              },
              "additionalProperties": false
            },
            "version": { "type": "string", "minLength": 1, "maxLength": 100 },
            "image": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
            }
          },
          "required": ["type", "version", "image"],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": { "type": "string", "const": "nixpacks" },
            "context": {
              "default": ".",
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "arguments": {
              "default": {},
              "type": "object",
              "propertyNames": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "additionalProperties": { "type": "string", "maxLength": 4096 }
            },
            "resources": {
              "default": { "cpus": 2, "memory": "2g" },
              "type": "object",
              "properties": {
                "cpus": {
                  "default": 2,
                  "type": "number",
                  "exclusiveMinimum": 0,
                  "maximum": 128
                },
                "memory": {
                  "default": "2g",
                  "type": "string",
                  "pattern": "^\\d+(?:\\.\\d+)?(?:[kmgt]i?b?|b)$"
                }
              },
              "additionalProperties": false
            },
            "buildCommand": {
              "minItems": 1,
              "maxItems": 64,
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
            },
            "startCommand": {
              "minItems": 1,
              "maxItems": 64,
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
            },
            "configFile": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "architecture": { "type": "string", "enum": ["amd64", "arm64"] },
            "timeoutSeconds": {
              "default": 2700,
              "type": "integer",
              "minimum": 60,
              "maximum": 7200
            },
            "cache": {
              "type": "object",
              "properties": {
                "enabled": { "default": true, "type": "boolean" },
                "scope": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9])?$"
                }
              },
              "additionalProperties": false
            },
            "version": { "type": "string", "minLength": 1, "maxLength": 100 },
            "image": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
            }
          },
          "required": ["type", "version", "image"],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": { "type": "string", "const": "buildpack" },
            "context": {
              "default": ".",
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "arguments": {
              "default": {},
              "type": "object",
              "propertyNames": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "additionalProperties": { "type": "string", "maxLength": 4096 }
            },
            "resources": {
              "default": { "cpus": 2, "memory": "2g" },
              "type": "object",
              "properties": {
                "cpus": {
                  "default": 2,
                  "type": "number",
                  "exclusiveMinimum": 0,
                  "maximum": 128
                },
                "memory": {
                  "default": "2g",
                  "type": "string",
                  "pattern": "^\\d+(?:\\.\\d+)?(?:[kmgt]i?b?|b)$"
                }
              },
              "additionalProperties": false
            },
            "buildCommand": {
              "minItems": 1,
              "maxItems": 64,
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
            },
            "startCommand": {
              "minItems": 1,
              "maxItems": 64,
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
            },
            "configFile": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "architecture": { "type": "string", "enum": ["amd64", "arm64"] },
            "timeoutSeconds": {
              "default": 2700,
              "type": "integer",
              "minimum": 60,
              "maximum": 7200
            },
            "cache": {
              "type": "object",
              "properties": {
                "enabled": { "default": true, "type": "boolean" },
                "scope": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9])?$"
                }
              },
              "additionalProperties": false
            },
            "packImage": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
            },
            "builder": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
            },
            "buildpacks": {
              "maxItems": 20,
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 512 }
            }
          },
          "required": ["type", "packImage", "builder"],
          "additionalProperties": false
        }
      ]
    },
    "dockerfile": { "type": "string", "minLength": 1, "maxLength": 1024 },
    "context": { "type": "string", "minLength": 1, "maxLength": 1024 },
    "buildServer": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "ip": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "ipv4",
                  "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$"
                },
                {
                  "type": "string",
                  "format": "ipv6",
                  "pattern": "^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$"
                }
              ]
            },
            "allowRuntimeFallback": { "default": false, "type": "boolean" },
            "transfer": {
              "default": "direct",
              "type": "string",
              "enum": ["direct", "registry"]
            },
            "registry": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
            },
            "architecture": { "type": "string", "enum": ["amd64", "arm64"] }
          },
          "required": ["ip"],
          "additionalProperties": false
        },
        { "type": "null" }
      ]
    },
    "rollout": {
      "default": {
        "type": "rolling",
        "replicas": 1,
        "maxSurge": 1,
        "maxUnavailable": 0,
        "startupDeadlineSeconds": 300,
        "minimumHealthySeconds": 10,
        "failureThreshold": 3,
        "drainSeconds": 10,
        "terminationSeconds": 30
      },
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "type": { "type": "string", "const": "rolling" },
            "replicas": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "maxSurge": {
              "default": 1,
              "type": "integer",
              "minimum": 0,
              "maximum": 100
            },
            "maxUnavailable": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 100
            },
            "startupDeadlineSeconds": {
              "default": 300,
              "type": "integer",
              "minimum": 1,
              "maximum": 86400
            },
            "minimumHealthySeconds": {
              "default": 10,
              "type": "integer",
              "minimum": 0,
              "maximum": 600
            },
            "failureThreshold": {
              "default": 3,
              "type": "integer",
              "minimum": 1,
              "maximum": 20
            },
            "drainSeconds": {
              "default": 10,
              "type": "integer",
              "minimum": 0,
              "maximum": 600
            },
            "terminationSeconds": {
              "default": 30,
              "type": "integer",
              "minimum": 1,
              "maximum": 86400
            }
          },
          "required": ["type"],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": { "type": "string", "const": "recreate" },
            "reason": { "type": "string", "minLength": 1, "maxLength": 500 },
            "maintenanceMode": { "default": false, "type": "boolean" },
            "terminationSeconds": {
              "default": 30,
              "type": "integer",
              "minimum": 1,
              "maximum": 86400
            }
          },
          "required": ["type", "reason"],
          "additionalProperties": false
        }
      ]
    },
    "externalSecrets": {
      "type": "object",
      "propertyNames": { "type": "string", "minLength": 1, "maxLength": 256 },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "integration": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
          },
          "secret": { "type": "string", "minLength": 1, "maxLength": 1024 },
          "field": { "type": "string", "minLength": 1, "maxLength": 256 },
          "version": { "type": "string", "minLength": 1, "maxLength": 256 },
          "use": { "type": "string", "enum": ["runtime", "build"] }
        },
        "required": ["integration", "secret", "use"],
        "additionalProperties": false
      }
    },
    "telemetry": {
      "type": "object",
      "properties": {
        "integration": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
        },
        "signals": {
          "minItems": 1,
          "maxItems": 3,
          "type": "array",
          "items": { "type": "string", "enum": ["logs", "metrics", "traces"] }
        },
        "protocol": {
          "default": "otlp-grpc",
          "type": "string",
          "enum": ["otlp-http", "otlp-grpc"]
        },
        "sampling": {
          "default": 1,
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "redactAttributes": {
          "maxItems": 100,
          "type": "array",
          "items": { "type": "string", "minLength": 1, "maxLength": 256 }
        },
        "cardinalityLimit": {
          "default": 10000,
          "type": "integer",
          "minimum": 100,
          "maximum": 1000000
        }
      },
      "additionalProperties": false
    },
    "ingress": {
      "oneOf": [
        {
          "type": "object",
          "properties": { "type": { "type": "string", "const": "proxy" } },
          "required": ["type"],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": { "type": "string", "const": "cloudflare-tunnel" },
            "integration": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
            },
            "tunnel": { "type": "string", "minLength": 1, "maxLength": 128 },
            "access": { "default": false, "type": "boolean" }
          },
          "required": ["type", "integration"],
          "additionalProperties": false
        }
      ]
    },
    "container": {
      "type": "object",
      "properties": {
        "network": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$"
        },
        "networkAlias": {
          "type": "string",
          "pattern": "^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$"
        },
        "port": { "type": "integer", "minimum": 1, "maximum": 65535 },
        "volumes": {
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$"
              },
              "mountPath": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024
              },
              "initialData": {
                "type": "string",
                "enum": ["image", "previous-container"]
              }
            },
            "required": ["name", "mountPath"],
            "additionalProperties": false
          }
        },
        "resources": {
          "type": "object",
          "properties": {
            "cpus": { "type": "number", "exclusiveMinimum": 0, "maximum": 128 },
            "memory": {
              "type": "string",
              "pattern": "^\\d+(?:\\.\\d+)?[bkmg]$"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "health": {
      "type": "object",
      "properties": {
        "path": { "type": "string", "maxLength": 1024, "pattern": "^\\/.*" },
        "timeoutSeconds": { "type": "integer", "minimum": 5, "maximum": 600 }
      },
      "additionalProperties": false
    },
    "hooks": {
      "type": "object",
      "properties": {
        "postDeploy": {
          "type": "object",
          "properties": {
            "command": {
              "minItems": 1,
              "maxItems": 64,
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
            },
            "timeoutSeconds": {
              "type": "integer",
              "minimum": 5,
              "maximum": 1800
            }
          },
          "additionalProperties": false
        },
        "preDeploy": {
          "type": "object",
          "properties": {
            "command": {
              "minItems": 1,
              "maxItems": 64,
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
            },
            "timeoutSeconds": {
              "type": "integer",
              "minimum": 5,
              "maximum": 1800
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "domains": {
      "type": "object",
      "properties": {
        "primary": { "type": "string", "minLength": 1, "maxLength": 253 },
        "redirects": {
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "host": { "type": "string", "minLength": 1, "maxLength": 253 },
              "status": {
                "anyOf": [
                  { "type": "number", "const": 301 },
                  { "type": "number", "const": 302 }
                ]
              }
            },
            "required": ["host"],
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    "tls": {
      "type": "object",
      "properties": {
        "mode": { "type": "string", "enum": ["direct", "cloudflare-dns"] }
      },
      "additionalProperties": false
    },
    "preview": {
      "type": "object",
      "properties": {
        "domain": { "type": "string", "minLength": 1, "maxLength": 253 },
        "enabled": { "type": "boolean", "const": true },
        "ttlHours": { "type": "integer", "minimum": 1, "maximum": 720 }
      },
      "additionalProperties": false
    },
    "secrets": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "build": {
          "default": [],
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
          }
        },
        "runtime": {
          "default": [],
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
          }
        },
        "preDeploy": {
          "default": [],
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
          }
        },
        "postDeploy": {
          "default": [],
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
          }
        }
      },
      "additionalProperties": false
    },
    "environments": {
      "type": "object",
      "propertyNames": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "string",
        "pattern": "^[a-z][a-z0-9-]{0,62}$",
        "not": {
          "enum": [
            "preview",
            "previews",
            "__proto__",
            "constructor",
            "prototype"
          ]
        }
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "jobs": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9-]{0,62}$"
                },
                "description": { "type": "string", "maxLength": 500 },
                "command": {
                  "minItems": 1,
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096
                  }
                },
                "schedule": {
                  "type": "object",
                  "properties": {
                    "cron": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "timezone": {
                      "default": "UTC",
                      "type": "string",
                      "const": "UTC"
                    }
                  },
                  "required": ["cron"],
                  "additionalProperties": false
                },
                "timeoutSeconds": {
                  "default": 300,
                  "type": "integer",
                  "minimum": 5,
                  "maximum": 3600
                },
                "enabled": { "default": true, "type": "boolean" }
              },
              "required": ["name", "command", "schedule"],
              "additionalProperties": false
            }
          },
          "logDrains": {
            "maxItems": 6,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "newrelic",
                "axiom",
                "betterstack",
                "datadog",
                "otlp",
                "loki"
              ]
            }
          },
          "autoDeploy": {
            "anyOf": [
              { "type": "boolean" },
              {
                "type": "object",
                "properties": {
                  "inputs": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1024
                    }
                  }
                },
                "required": ["inputs"],
                "additionalProperties": false
              }
            ]
          },
          "vulnerabilityScanning": { "type": "boolean" },
          "description": { "type": "string", "maxLength": 500 },
          "server": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "string"
          },
          "deployment": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "dockerfile" },
                  "context": {
                    "default": ".",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "arguments": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 4096
                    }
                  },
                  "resources": {
                    "default": { "cpus": 2, "memory": "2g" },
                    "type": "object",
                    "properties": {
                      "cpus": {
                        "default": 2,
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 128
                      },
                      "memory": {
                        "default": "2g",
                        "type": "string",
                        "pattern": "^\\d+(?:\\.\\d+)?(?:[kmgt]i?b?|b)$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "dockerfile": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "target": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "architecture": {
                    "type": "string",
                    "enum": ["amd64", "arm64"]
                  },
                  "cache": {
                    "type": "object",
                    "properties": {
                      "enabled": { "default": true, "type": "boolean" },
                      "scope": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "pattern": "^[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9])?$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "timeoutSeconds": {
                    "default": 2700,
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 7200
                  }
                },
                "required": ["type", "dockerfile"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "static" },
                  "context": {
                    "default": ".",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "arguments": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 4096
                    }
                  },
                  "resources": {
                    "default": { "cpus": 2, "memory": "2g" },
                    "type": "object",
                    "properties": {
                      "cpus": {
                        "default": 2,
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 128
                      },
                      "memory": {
                        "default": "2g",
                        "type": "string",
                        "pattern": "^\\d+(?:\\.\\d+)?(?:[kmgt]i?b?|b)$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "output": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "buildCommand": {
                    "minItems": 1,
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    }
                  },
                  "architecture": {
                    "type": "string",
                    "enum": ["amd64", "arm64"]
                  },
                  "cache": {
                    "type": "object",
                    "properties": {
                      "enabled": { "default": true, "type": "boolean" },
                      "scope": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "pattern": "^[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9])?$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "nodeImage": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
                  },
                  "runtimeImage": {
                    "default": "nginxinc/nginx-unprivileged@sha256:0c79d56aee561a1d81c63f00eee5fb5fe29279560cdc55e91425133104c7fbe6",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
                  },
                  "spaFallback": { "default": false, "type": "boolean" },
                  "index": {
                    "default": "index.html",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "errorPage": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "headers": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128,
                      "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 2048
                    }
                  },
                  "timeoutSeconds": {
                    "default": 1800,
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 7200
                  }
                },
                "required": ["type", "output", "nodeImage"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "image" },
                  "image": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\s@]+(?:@sha256:[a-f0-9]{64})?$"
                  },
                  "registry": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
                  },
                  "platform": {
                    "type": "string",
                    "enum": ["linux/amd64", "linux/arm64"]
                  },
                  "pullPolicy": {
                    "default": "if-not-present",
                    "type": "string",
                    "enum": ["if-not-present", "always"]
                  }
                },
                "required": ["type", "image"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "railpack" },
                  "context": {
                    "default": ".",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "arguments": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 4096
                    }
                  },
                  "resources": {
                    "default": { "cpus": 2, "memory": "2g" },
                    "type": "object",
                    "properties": {
                      "cpus": {
                        "default": 2,
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 128
                      },
                      "memory": {
                        "default": "2g",
                        "type": "string",
                        "pattern": "^\\d+(?:\\.\\d+)?(?:[kmgt]i?b?|b)$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "buildCommand": {
                    "minItems": 1,
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    }
                  },
                  "startCommand": {
                    "minItems": 1,
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    }
                  },
                  "configFile": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "architecture": {
                    "type": "string",
                    "enum": ["amd64", "arm64"]
                  },
                  "timeoutSeconds": {
                    "default": 2700,
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 7200
                  },
                  "cache": {
                    "type": "object",
                    "properties": {
                      "enabled": { "default": true, "type": "boolean" },
                      "scope": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "pattern": "^[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9])?$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "image": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
                  }
                },
                "required": ["type", "version", "image"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "nixpacks" },
                  "context": {
                    "default": ".",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "arguments": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 4096
                    }
                  },
                  "resources": {
                    "default": { "cpus": 2, "memory": "2g" },
                    "type": "object",
                    "properties": {
                      "cpus": {
                        "default": 2,
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 128
                      },
                      "memory": {
                        "default": "2g",
                        "type": "string",
                        "pattern": "^\\d+(?:\\.\\d+)?(?:[kmgt]i?b?|b)$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "buildCommand": {
                    "minItems": 1,
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    }
                  },
                  "startCommand": {
                    "minItems": 1,
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    }
                  },
                  "configFile": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "architecture": {
                    "type": "string",
                    "enum": ["amd64", "arm64"]
                  },
                  "timeoutSeconds": {
                    "default": 2700,
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 7200
                  },
                  "cache": {
                    "type": "object",
                    "properties": {
                      "enabled": { "default": true, "type": "boolean" },
                      "scope": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "pattern": "^[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9])?$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "image": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
                  }
                },
                "required": ["type", "version", "image"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "buildpack" },
                  "context": {
                    "default": ".",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "arguments": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 4096
                    }
                  },
                  "resources": {
                    "default": { "cpus": 2, "memory": "2g" },
                    "type": "object",
                    "properties": {
                      "cpus": {
                        "default": 2,
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 128
                      },
                      "memory": {
                        "default": "2g",
                        "type": "string",
                        "pattern": "^\\d+(?:\\.\\d+)?(?:[kmgt]i?b?|b)$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "buildCommand": {
                    "minItems": 1,
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    }
                  },
                  "startCommand": {
                    "minItems": 1,
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    }
                  },
                  "configFile": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "architecture": {
                    "type": "string",
                    "enum": ["amd64", "arm64"]
                  },
                  "timeoutSeconds": {
                    "default": 2700,
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 7200
                  },
                  "cache": {
                    "type": "object",
                    "properties": {
                      "enabled": { "default": true, "type": "boolean" },
                      "scope": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "pattern": "^[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9])?$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "packImage": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
                  },
                  "builder": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\s@]+@sha256:[a-f0-9]{64}$"
                  },
                  "buildpacks": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    }
                  }
                },
                "required": ["type", "packImage", "builder"],
                "additionalProperties": false
              }
            ]
          },
          "dockerfile": { "type": "string", "minLength": 1, "maxLength": 1024 },
          "context": { "type": "string", "minLength": 1, "maxLength": 1024 },
          "buildServer": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "ip": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "ipv4",
                        "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$"
                      },
                      {
                        "type": "string",
                        "format": "ipv6",
                        "pattern": "^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$"
                      }
                    ]
                  },
                  "allowRuntimeFallback": {
                    "default": false,
                    "type": "boolean"
                  },
                  "transfer": {
                    "default": "direct",
                    "type": "string",
                    "enum": ["direct", "registry"]
                  },
                  "registry": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
                  },
                  "architecture": {
                    "type": "string",
                    "enum": ["amd64", "arm64"]
                  }
                },
                "required": ["ip"],
                "additionalProperties": false
              },
              { "type": "null" }
            ]
          },
          "rollout": {
            "default": {
              "type": "rolling",
              "replicas": 1,
              "maxSurge": 1,
              "maxUnavailable": 0,
              "startupDeadlineSeconds": 300,
              "minimumHealthySeconds": 10,
              "failureThreshold": 3,
              "drainSeconds": 10,
              "terminationSeconds": 30
            },
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "rolling" },
                  "replicas": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "maxSurge": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "maxUnavailable": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "startupDeadlineSeconds": {
                    "default": 300,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 86400
                  },
                  "minimumHealthySeconds": {
                    "default": 10,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 600
                  },
                  "failureThreshold": {
                    "default": 3,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20
                  },
                  "drainSeconds": {
                    "default": 10,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 600
                  },
                  "terminationSeconds": {
                    "default": 30,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 86400
                  }
                },
                "required": ["type"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "recreate" },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "maintenanceMode": { "default": false, "type": "boolean" },
                  "terminationSeconds": {
                    "default": 30,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 86400
                  }
                },
                "required": ["type", "reason"],
                "additionalProperties": false
              }
            ]
          },
          "externalSecrets": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "integration": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
                },
                "secret": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                },
                "field": { "type": "string", "minLength": 1, "maxLength": 256 },
                "version": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "use": { "type": "string", "enum": ["runtime", "build"] }
              },
              "required": ["integration", "secret", "use"],
              "additionalProperties": false
            }
          },
          "telemetry": {
            "type": "object",
            "properties": {
              "integration": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
              },
              "signals": {
                "minItems": 1,
                "maxItems": 3,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": ["logs", "metrics", "traces"]
                }
              },
              "protocol": {
                "default": "otlp-grpc",
                "type": "string",
                "enum": ["otlp-http", "otlp-grpc"]
              },
              "sampling": {
                "default": 1,
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "redactAttributes": {
                "maxItems": 100,
                "type": "array",
                "items": { "type": "string", "minLength": 1, "maxLength": 256 }
              },
              "cardinalityLimit": {
                "default": 10000,
                "type": "integer",
                "minimum": 100,
                "maximum": 1000000
              }
            },
            "additionalProperties": false
          },
          "ingress": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "proxy" }
                },
                "required": ["type"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "cloudflare-tunnel" },
                  "integration": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
                  },
                  "tunnel": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "access": { "default": false, "type": "boolean" }
                },
                "required": ["type", "integration"],
                "additionalProperties": false
              }
            ]
          },
          "container": {
            "type": "object",
            "properties": {
              "network": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$"
              },
              "networkAlias": {
                "type": "string",
                "pattern": "^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$"
              },
              "port": { "type": "integer", "minimum": 1, "maximum": 65535 },
              "volumes": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$"
                    },
                    "mountPath": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1024
                    },
                    "initialData": {
                      "type": "string",
                      "enum": ["image", "previous-container"]
                    }
                  },
                  "required": ["name", "mountPath"],
                  "additionalProperties": false
                }
              },
              "resources": {
                "type": "object",
                "properties": {
                  "cpus": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 128
                  },
                  "memory": {
                    "type": "string",
                    "pattern": "^\\d+(?:\\.\\d+)?[bkmg]$"
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          "health": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string",
                "maxLength": 1024,
                "pattern": "^\\/.*"
              },
              "timeoutSeconds": {
                "type": "integer",
                "minimum": 5,
                "maximum": 600
              }
            },
            "additionalProperties": false
          },
          "hooks": {
            "type": "object",
            "properties": {
              "postDeploy": {
                "type": "object",
                "properties": {
                  "command": {
                    "minItems": 1,
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    }
                  },
                  "timeoutSeconds": {
                    "type": "integer",
                    "minimum": 5,
                    "maximum": 1800
                  }
                },
                "additionalProperties": false
              },
              "preDeploy": {
                "type": "object",
                "properties": {
                  "command": {
                    "minItems": 1,
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    }
                  },
                  "timeoutSeconds": {
                    "type": "integer",
                    "minimum": 5,
                    "maximum": 1800
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          "domains": {
            "type": "object",
            "properties": {
              "primary": { "type": "string", "minLength": 1, "maxLength": 253 },
              "redirects": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "host": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 253
                    },
                    "status": {
                      "anyOf": [
                        { "type": "number", "const": 301 },
                        { "type": "number", "const": 302 }
                      ]
                    }
                  },
                  "required": ["host"],
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false
          },
          "tls": {
            "type": "object",
            "properties": {
              "mode": { "type": "string", "enum": ["direct", "cloudflare-dns"] }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false,
  "required": ["id", "name", "environments"],
  "description": "Entity defaults are merged with the selected environment before full validation during sync. Branch mappings and secret values are managed in Towbar.",
  "$id": "https://www.towbar.dev/schemas/app.v2.json"
}
