{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Fork Environment",
  "description": "Create or update a fork of an existing environment.",
  "type": "object",
  "required": ["name", "id"],
  "properties": {
    "name": {
      "type": "string",
      "title": "Environment Name",
      "description": "A human-readable name for the forked environment",
      "minLength": 1,
      "examples": ["Staging", "Feature Branch", "Preview"]
    },
    "id": {
      "type": "string",
      "title": "Environment ID",
      "description": "A short, memorable identifier for looking up this environment in the API and CLI. This becomes the second segment of instance identifiers. Max 20 characters, lowercase alphanumeric only (a-z, 0-9). Immutable after creation.",
      "minLength": 1,
      "maxLength": 20,
      "pattern": "^[a-z0-9]{1,20}$",
      "examples": ["staging", "preview", "feature1"]
    },
    "description": {
      "type": "string",
      "title": "Environment Description",
      "description": "An optional description of the forked environment's purpose",
      "maxLength": 255,
      "examples": ["Preview environment for the payments refactor"]
    },
    "attributes": {
      "type": "object",
      "title": "Attributes",
      "description": "Key-value attributes for this environment. Keys and values must be strings. Must conform to the organization's custom attributes for the environment scope.",
      "additionalProperties": { "type": "string" },
      "default": {},
      "x-gql-type": "map"
    },
    "decommissionProtection": {
      "type": "boolean",
      "title": "Decommission Protection",
      "description": "When true, blocks `decommissionEnvironment` and any per-instance deployment with `action: DECOMMISSION` against this environment. Disable it via `updateEnvironment` before tearing down. Defaults to false.",
      "default": false
    },
    "separationOfDuty": {
      "type": "boolean",
      "title": "Separation of Duty",
      "description": "When true, `approveDeployment` rejects any approval from the account or service account that proposed the deployment — a proposal in this environment has to be approved by a second reviewer. Proposers can still reject their own proposals with `rejectDeployment`. Defaults to false.",
      "default": false
    },
    "copyEnvironmentDefaults": {
      "type": "boolean",
      "title": "Copy Environment Defaults",
      "description": "When true, copies the parent environment's default resource connections into the fork.",
      "default": false
    },
    "copySecrets": {
      "type": "boolean",
      "title": "Copy Secrets",
      "description": "When true, copies every package's secret values from the parent into the fork. Applies the same behavior as `copyInstance(copySecrets: true)` to every package in one call. Defaults to false.",
      "default": false
    },
    "copyRemoteReferences": {
      "type": "boolean",
      "title": "Copy Remote References",
      "description": "When true, copies every package's remote resource references from the parent into the fork. Applies the same behavior as `copyInstance(copyRemoteReferences: true)` to every package in one call. Defaults to false.",
      "default": false
    }
  }
}
