{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eurobase-dev/json-schema/eurobase-dev-deployment-create-request-schema.json",
  "title": "DeploymentCreateRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eurobase-dev-deployments-api-openapi.yml#/components/schemas/DeploymentCreateRequest",
  "type": "object",
  "required": [
    "projectId"
  ],
  "additionalProperties": false,
  "properties": {
    "projectId": {
      "type": "string"
    },
    "blockedPushEventId": {
      "type": "string",
      "description": "Retry a quota-blocked push through normal deploy admission, using its immutable commit and requiring the project repository and branch to match."
    },
    "sourceDeploymentId": {
      "type": "string",
      "description": "Optional selected deployment id whose source, config, and commit should be replayed."
    },
    "commitSha": {
      "type": "string",
      "description": "Optional explicit commit SHA for a normal project source deployment."
    },
    "sourceConfirmation": {
      "$ref": "#/$defs/ProjectSourceConfirmation",
      "description": "Saved source identity returned by app-source detection. Fresh deployments with an explicit commit reject a changed source before admission and again under the project transaction lock."
    },
    "sourceBuildEngineChange": {
      "$ref": "#/$defs/SourceBuildEngineChange",
      "description": "Fresh deploy only (no sourceDeploymentId, no appSource): switches the stored runtime and queues the commit in one transaction. With sourceDeploymentId it is refused with 400 source-build-engine-change-invalid."
    }
  },
  "$defs": {
    "ProjectSourceConfirmation": {
      "type": "object",
      "required": [
        "repository",
        "branch",
        "rootDirectory",
        "configurationHash"
      ],
      "additionalProperties": false,
      "properties": {
        "repository": {
          "type": "string",
          "minLength": 1
        },
        "branch": {
          "type": "string",
          "minLength": 1
        },
        "rootDirectory": {
          "type": "string",
          "minLength": 1
        },
        "configurationHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$",
          "description": "API-owned binding of the saved source defaults, excluding detector caches and unrelated project updates."
        }
      }
    },
    "SourceBuildEngineChange": {
      "type": "object",
      "description": "Explicit confirmation of a project runtime switch (ADR 0076 D2), applied as compare-and-set under the project row lock: from is the stored engine and to the engine detected for the admitted commit. Refused on redeploys and never read from pushes.",
      "required": [
        "from",
        "to"
      ],
      "additionalProperties": false,
      "properties": {
        "from": {
          "type": "string",
          "enum": [
            "direct-static-v1",
            "paketo-v1",
            "workers-v1"
          ]
        },
        "to": {
          "type": "string",
          "enum": [
            "direct-static-v1",
            "paketo-v1",
            "workers-v1"
          ]
        }
      }
    }
  }
}