{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://ziggyserver.ru/layerplan/spec/economy-report.schema.json",
  "title": "EconomyReport",
  "description": "Выход L1 Economy Engine. Заполняется в WorldSnapshot.economy каждый тик.",
  "type": "object",
  "required": ["prices", "r_efficiency", "abundance_index"],
  "properties": {
    "prices": {
      "type": "object",
      "patternProperties": {
        "^[a-z_]+$": { "type": "number", "minimum": 0 }
      },
      "description": "Текущие цены на все ресурсы. map[ResourceType → цена]"
    },
    "routes_pnl": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "route_id": { "type": "string" },
          "revenue": { "type": "number" },
          "cost": { "type": "number", "minimum": 0 },
          "profit": { "type": "number" },
          "cargo_delivered": { "type": "number", "minimum": 0 },
          "trips_completed": { "type": "integer", "minimum": 0 }
        }
      },
      "description": "Прибыль по каждому маршруту за последний тик"
    },
    "r_efficiency": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "R-КПД замкнутого цикла. 1.0 = идеальный цикл, 0.0 = полные потери."
    },
    "abundance_index": {
      "type": "number",
      "minimum": 0,
      "description": "A(t) — индекс изобилия. Единиц свободного ресурса на жителя."
    },
    "inflation_rate": {
      "type": "number",
      "description": "Темп инфляции за тик (доля). 0.01 = 1% инфляции."
    },
    "supply_demand_ratios": {
      "type": "object",
      "patternProperties": {
        "^[a-z_]+$": { "type": "number" }
      },
      "description": "D/S для каждого ресурса. >1 = дефицит, <1 = избыток."
    },
    "city_stats": {
      "type": "object",
      "patternProperties": {
        "^[a-z_]+$": {
          "type": "object",
          "properties": {
            "population": { "type": "integer", "minimum": 0 },
            "growth_rate": { "type": "number", "description": "Прирост населения за тик (доля)" },
            "satisfaction": { "type": "number", "minimum": 0, "maximum": 1, "description": "Удовлетворённость 0–1" }
          }
        }
      }
    }
  }
}
