{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ezkeel.com/spec/v1/ezkeel.schema.json",
  "title": "EZKeel Deploy Spec v1",
  "description": "Per-application declarative deploy spec. Required first line in YAML form: '# spec: ezkeel/v1'. Read by 'ezkeel up'.",
  "type": "object",
  "required": ["name"],
  "additionalProperties": false,
  "properties": {
    "name": {
      "type": "string",
      "pattern": "^[a-z0-9]([a-z0-9-]*[a-z0-9])?$",
      "minLength": 1,
      "maxLength": 63,
      "description": "RFC 1123-style hostname. Lowercase letters, digits, dashes; cannot start or end with a dash."
    },
    "framework": {
      "type": "string",
      "description": "Override framework auto-detection. Supported: nextjs, remix, nuxt, astro, vite, express, hono, fastify, fastapi, django, flask, go, rust, rails, static."
    },
    "build": {
      "type": "string",
      "description": "Override the framework's default build command."
    },
    "start": {
      "type": "string",
      "description": "Override the framework's default start command. Leading env-var assignments (NODE_ENV=...) route to shell-form CMD; flags like --host=0.0.0.0 stay in exec-form."
    },
    "port": {
      "type": "integer",
      "minimum": 1,
      "maximum": 65535
    },
    "services": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": ["engine"],
        "additionalProperties": false,
        "properties": {
          "engine": {
            "type": "string",
            "enum": ["postgres", "postgresql", "pg"],
            "description": "Currently only postgres is provisioned end-to-end. mysql/mariadb are reserved for v1.x."
          },
          "version": {
            "type": "string",
            "description": "Engine version, e.g. '16' for Postgres 16. Defaults to '16' when omitted."
          }
        }
      }
    },
    "runtime": {
      "type": "string",
      "enum": ["docker", "sysbox"],
      "default": "docker",
      "description": "Container runtime on the host. sysbox is reserved; not yet wired by the bootstrap."
    },
    "sandbox": {
      "type": "boolean",
      "default": false,
      "description": "Reserved for v1.x kernel-isolated sandboxing."
    },
    "env": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Required env-var keys. Values resolved from Infisical or platform env."
    },
    "resources": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "memory": {
          "type": "string",
          "pattern": "^[0-9]+(m|g)$",
          "description": "Container memory cap, e.g. 512m, 1g."
        },
        "cpus": {
          "type": "string",
          "pattern": "^[0-9]+(\\.[0-9]+)?$",
          "description": "CPU cap, e.g. 1.0, 0.5."
        }
      }
    }
  }
}
