{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arcnm-io/json-schema/arcnm-io-environment-detail-schema.json",
  "title": "EnvironmentDetail",
  "description": "`GET /environments/{env_id}` — what this environment states.\n\nEvery economics value here is the environment's OWN statement, and null\nmeans it states nothing: the value then resolves from the parent\nenvironment, and from ITS parent above that, reaching the platform\ndefault only when no environment in the chain states one. So a null here\nis not \"no value\" — `GET /environments/{env_id}/assumptions` publishes\nthe figure a quote is actually built with, and the environment that\nstated it.\n\n`PATCH /environments/{env_id}/economics` is the setter for everything\nhere except the labour rate and the two overheads. Those are read-only\non this surface: their setter is the rate row, and an effective rate row\nfor the driver beats the column outright wherever one exists.",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arcnm-io-openapi.yml#/components/schemas/EnvironmentDetail",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id",
      "description": "Unique identifier of the costing environment."
    },
    "name": {
      "type": "string",
      "title": "Name",
      "description": "Human-readable name of the costing environment."
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description",
      "description": "Optional longer description of the environment."
    },
    "region": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Region",
      "description": "Geographic region this environment prices for (e.g. DE, US)."
    },
    "currency": {
      "type": "string",
      "title": "Currency",
      "description": "ISO 4217 currency code the environment's rates are denominated in."
    },
    "valid_from": {
      "type": "string",
      "title": "Valid From",
      "description": "ISO date (YYYY-MM-DD) from which this environment is effective."
    },
    "valid_to": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Valid To",
      "description": "ISO date (YYYY-MM-DD) the environment stops being effective; null = open-ended."
    },
    "is_baseline": {
      "type": "boolean",
      "title": "Is Baseline",
      "description": "Whether this is the auto-provisioned default environment for the tenant."
    },
    "parent_environment_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Parent Environment Id",
      "description": "Environment this one inherits from, or null when it stands alone. Anything this environment does not state itself resolves from the parent and, recursively, from the parent's parent."
    },
    "machine_count": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Machine Count",
      "description": "Machines currently in this environment's fleet."
    },
    "tool_count": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tool Count",
      "description": "Crib tools currently attached to this environment."
    },
    "rate_count": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Rate Count",
      "description": "Rate rows this environment states itself (every kind, every validity window) — what `GET /{env_id}/rates` returns. Rates it only inherits from its parent are not counted."
    },
    "subcontractor_count": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Subcontractor Count",
      "description": "Subcontractors this environment orders from."
    },
    "machines_cloned": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Machines Cloned",
      "description": "Number of machines copied into the environment; only set by the clone endpoints."
    },
    "rates_cloned": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Rates Cloned",
      "description": "Number of rate rows copied into the environment; only set by the clone endpoints."
    },
    "scheduled_changes_dropped": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Scheduled Changes Dropped",
      "description": "Memberships of the source whose validity window is not active today (scheduled future additions or removals). A clone is a snapshot as of today, so these do not travel; re-schedule them on the copy if you need them. Only set by the clone endpoint."
    },
    "source_preset_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Source Preset Id",
      "description": "Environment this one was cloned from (lineage)."
    },
    "config_revision": {
      "type": "integer",
      "title": "Config Revision",
      "description": "Monotonic configuration revision; every configuration write increments it, and each calculation records the revision it priced under.",
      "default": 0
    },
    "default_labour_rate_eur_per_h": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Default Labour Rate Eur Per H",
      "description": "Labour rate (EUR/h) this environment states. Read-only here: an effective labour rate row beats this column outright, and that row is the setter. Null = states nothing, so the parent environment's value applies, else the platform default."
    },
    "overhead_var_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Overhead Var Pct",
      "description": "Variable-overhead fraction this environment states. Read-only here: an effective variable-overhead rate row beats this column outright, and that row is the setter. Null = states nothing, so the parent environment's value applies, else none: the platform charges no variable overhead nobody stated. The Zuschlagskalkulation ladder and this rate are one overhead system, never charged together by default."
    },
    "overhead_fixed_eur_per_part": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Overhead Fixed Eur Per Part",
      "description": "Fixed overhead (EUR/part) this environment states. Read-only here: an effective fixed-overhead rate row beats this column outright, and that row is the setter. Null = states nothing, so the parent environment's value applies, else the platform default."
    },
    "energy_eur_per_kwh": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Energy Eur Per Kwh",
      "description": "Energy price (EUR/kWh) this environment states; null = states nothing, so the parent environment's value applies, else the platform default."
    },
    "space_eur_per_m2_y": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Space Eur Per M2 Y",
      "description": "Floor-space cost (EUR/m²·year) this environment states; null = states nothing, so the parent environment's value applies, else the platform default."
    },
    "default_material_family": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Default Material Family",
      "description": "Default material family this environment states for calcs that name no grade; null = states nothing, so the parent environment's value applies, else the platform default."
    },
    "material_overhead_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Material Overhead Pct",
      "description": "Procurement / storage surcharge on material cost this environment states (0.07 = 7 %); null = states nothing, so the parent environment's value applies, else the platform default, which adds no surcharge."
    },
    "production_overhead_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Production Overhead Pct",
      "description": "Surcharge on production wages this environment states (0.80 = 80 %); null = states nothing, so the parent environment's value applies, else the platform default, which adds no surcharge."
    },
    "sga_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sga Pct",
      "description": "Administration and selling surcharge on manufacturing cost this environment states; null = states nothing, so the parent environment's value applies, else the platform default, which adds no surcharge."
    },
    "margin_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Margin Pct",
      "description": "Profit mark-up on total cost this environment states; null = states nothing, so the parent environment's value applies, else the platform default, which adds no mark-up — the quote is a should-cost."
    },
    "freight_eur_per_part": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Freight Eur Per Part",
      "description": "Outbound freight per unit this environment states, in its own currency; null = states nothing, so the parent environment's value applies, else the platform default, which is none."
    },
    "duty_eur_per_part": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Duty Eur Per Part",
      "description": "Customs duty per unit this environment states, in its own currency; null = states nothing, so the parent environment's value applies, else the platform default, which is none."
    },
    "packaging_eur_per_part": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Packaging Eur Per Part",
      "description": "Packaging material per unit this environment states, in its own currency; null = states nothing, so the parent environment's value applies, else the platform default, which is none."
    },
    "cash_discount_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cash Discount Pct",
      "description": "Customer cash discount (Kundenskonto) this environment prices into the offer, as a fraction of the target price, 'im Hundert' (0.02 = 2 %); null = states nothing, so the parent environment's value applies, else the platform default, which is none."
    },
    "sales_commission_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sales Commission Pct",
      "description": "Sales commission (Vertreterprovision) this environment prices into the offer, as a fraction of the target price, 'im Hundert'; null = states nothing, so the parent environment's value applies, else the platform default, which is none."
    },
    "customer_discount_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Customer Discount Pct",
      "description": "Customer discount (Kundenrabatt) this environment prices into the offer, as a fraction of the list price, 'im Hundert'; null = states nothing, so the parent environment's value applies, else the platform default, which is none."
    },
    "reject_rate_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reject Rate Pct",
      "description": "Share of started parts this environment states that the shop rejects (0.03 = 3 %); null = states nothing, so the parent environment's value applies, else the platform default, which rejects none."
    },
    "reject_rate_base": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reject Rate Base",
      "description": "What a reject costs, as this environment states it: 'material' (the stock drawn for the rejected parts) or 'herstellkosten' (the whole part before scrap, for rejects found at final inspection); null = states nothing, so the parent environment's value applies, else the platform default, 'material'."
    },
    "scrap_credit_eur_per_kg": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Scrap Credit Eur Per Kg",
      "description": "Flat return per kg of scrap this environment states, net of the cost of selling it, in its own currency; null = states nothing, so the parent environment's value applies, else the platform default, which is none."
    },
    "subcontract_overhead_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Subcontract Overhead Pct",
      "description": "Procurement overhead on subcontract work this environment states, as a fraction of the subcontract cost (0.05 = 5 %); null = states nothing, so the parent environment's value applies, else the platform default, which is none."
    },
    "margin_base": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Margin Base",
      "description": "The base of the profit mark-up, as this environment states it: 'selbstkosten' (total cost) or 'netto_selbstkosten' (total cost without packaging, freight and duty); null = states nothing, so the parent environment's value applies, else the platform default, 'selbstkosten'."
    },
    "factor_first_off": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Factor First Off",
      "description": "First-article-inspection factor this environment states: it scales a full inspection into the per-lot first-off time (0 = none). Null = states nothing, so the parent environment's value applies, else the platform default."
    },
    "sample_pct_default": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sample Pct Default",
      "description": "In-process inspection sampling fraction (0..1) this environment states; null = states nothing, so the parent environment's value applies, else the platform default."
    },
    "fai_cost": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Fai Cost",
      "description": "Flat first-article-inspection cost per lot this environment states, in its own currency; null = states nothing, so the parent environment's value applies, else the platform default."
    },
    "eoq_holding_cost_per_kg_per_year": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Eoq Holding Cost Per Kg Per Year",
      "description": "Storage charge for finished stock this environment states, per kg and year; null = states nothing, so the parent environment's value applies, else the platform default."
    },
    "holding_cost_rate_per_year": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Holding Cost Rate Per Year",
      "description": "Imputed interest rate on capital tied up in finished stock this environment states, per year (0.08 = 8 %); null = states nothing, so the parent environment's value applies, else the platform default."
    },
    "ordering_cost_eur_per_order": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ordering Cost Eur Per Order",
      "description": "The buyer's fixed cost of placing and receiving one order (Bestellkosten je Bestellvorgang) this environment states, in its own currency; null = states nothing, so the parent environment's value applies, else the platform default of 0. Read by the lot-size scenarios where the buyer orders in lots."
    }
  },
  "type": "object",
  "required": [
    "id",
    "name",
    "currency",
    "valid_from",
    "is_baseline"
  ]
}