{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arcnm-io/json-schema/arcnm-io-machine-usage-schema.json",
  "title": "MachineUsage",
  "description": "Where a machine record is in use — the scope of an edit to it.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arcnm-io-machines-api-openapi.yml#/components/schemas/MachineUsage",
  "properties": {
    "machine_id": {
      "type": "string",
      "title": "Machine Id",
      "description": "Identifier of the machine."
    },
    "environment_count": {
      "type": "integer",
      "title": "Environment Count",
      "description": "Number of your costing environments whose fleet holds this machine today. An edit to the machine's own rate reaches every one of them."
    },
    "environments": {
      "items": {
        "$ref": "#/$defs/MachineUsageEnv"
      },
      "type": "array",
      "title": "Environments",
      "description": "Those environments, enabled and disabled memberships alike."
    }
  },
  "type": "object",
  "required": [
    "machine_id",
    "environment_count",
    "environments"
  ],
  "$defs": {
    "MachineUsageEnv": {
      "properties": {
        "env_id": {
          "type": "string",
          "title": "Env Id",
          "description": "Identifier of the environment."
        },
        "env_name": {
          "type": "string",
          "title": "Env Name",
          "description": "Human-readable environment name."
        },
        "is_enabled": {
          "type": "boolean",
          "title": "Is Enabled",
          "description": "Whether the machine is active in that environment's fleet. Only enabled machines take part in calculations."
        }
      },
      "type": "object",
      "required": [
        "env_id",
        "env_name",
        "is_enabled"
      ],
      "title": "MachineUsageEnv",
      "description": "One costing environment whose fleet holds this machine."
    }
  }
}