{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://minerapi.com/assets/downloads/sample.schema.json",
  "title": "MinerAPI.com public demonstration response",
  "description": "Version 1.0 of the three bundled, fictional, read-only JSON fixture responses. This is not a live mining service.",
  "type": "object",
  "required": [
    "demo",
    "schema_version",
    "kind",
    "label",
    "source",
    "observed_at",
    "display_metrics",
    "rows_title",
    "display_rows",
    "chart_title",
    "chart_values"
  ],
  "properties": {
    "demo": {
      "const": true
    },
    "schema_version": {
      "const": "1.0"
    },
    "kind": {
      "enum": [
        "asic",
        "gpu",
        "prompts"
      ]
    },
    "label": {
      "type": "string"
    },
    "source": {
      "const": "bundled-sample"
    },
    "observed_at": {
      "type": "string",
      "format": "date-time"
    },
    "worker": {
      "type": "object",
      "required": [
        "id",
        "algorithm",
        "power_w",
        "status"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "algorithm": {
          "type": "string"
        },
        "hashrate_th_s": {
          "type": "number",
          "minimum": 0
        },
        "hashrate_mh_s": {
          "type": "number",
          "minimum": 0
        },
        "power_w": {
          "type": "number",
          "minimum": 0
        },
        "chip_temp_c": {
          "type": "number"
        },
        "temperature_c": {
          "type": "number"
        },
        "fan_rpm": {
          "type": "number",
          "minimum": 0
        },
        "utilization_percent": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "status": {
          "type": "string"
        }
      }
    },
    "prompt": {
      "type": "object",
      "required": [
        "id",
        "version",
        "task",
        "variables",
        "dataset_version",
        "evaluator_version",
        "test_cases",
        "passed",
        "failed"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "task": {
          "type": "string"
        },
        "variables": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "dataset_version": {
          "type": "string"
        },
        "evaluator_version": {
          "type": "string"
        },
        "test_cases": {
          "type": "integer",
          "minimum": 0
        },
        "passed": {
          "type": "integer",
          "minimum": 0
        },
        "failed": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "display_metrics": {
      "type": "array",
      "minItems": 4,
      "maxItems": 4,
      "items": {
        "type": "object",
        "required": [
          "label",
          "value",
          "unit",
          "note"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "note": {
            "type": "string"
          }
        }
      }
    },
    "rows_title": {
      "type": "string"
    },
    "display_rows": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "label",
          "value",
          "style"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "style": {
            "enum": [
              "",
              "warn",
              "off"
            ]
          }
        }
      }
    },
    "chart_title": {
      "type": "string"
    },
    "chart_values": {
      "type": "array",
      "minItems": 2,
      "items": {
        "type": "number",
        "minimum": 0,
        "maximum": 100
      },
      "description": "Illustrative unitless chart coordinates, not a time series of operational observations."
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "kind": {
            "const": "prompts"
          }
        }
      },
      "then": {
        "required": [
          "prompt"
        ]
      },
      "else": {
        "required": [
          "worker"
        ]
      }
    }
  ]
}
