{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object", "additionalProperties": false,
  "required": ["source", "cfadsFactor", "opening"],
  "properties": {
    "cfadsFactor": {"enum": [1, 0.8]},
    "opening": {"type": "object", "additionalProperties": false, "required": ["mode", "amount"], "properties": {
      "mode": {"enum": ["minimum", "supplied"]},
      "amount": {"type": ["number", "null"], "minimum": 0, "maximum": 1000000}
    }, "allOf": [
      {"if": {"properties": {"mode": {"const": "minimum"}}}, "then": {"properties": {"amount": {"const": null}}}},
      {"if": {"properties": {"mode": {"const": "supplied"}}}, "then": {"properties": {"amount": {"type": "number"}}}}
    ]},
    "source": {"type": "object", "additionalProperties": false, "required": ["model", "inputSha256", "rows"], "properties": {
      "model": {"type": "string", "pattern": "^[a-z][a-z0-9-]+$"},
      "inputSha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
      "rows": {"type": "array", "minItems": 2, "maxItems": 30, "items": {
        "type": "object", "additionalProperties": false, "required": ["period", "label", "cfads", "service"],
        "properties": {"period": {"type": "integer", "minimum": 1, "maximum": 30}, "label": {"type": "string", "minLength": 1},
          "cfads": {"type": "number", "minimum": 0, "maximum": 1000000}, "service": {"type": "number", "minimum": 0, "maximum": 1000000}}
      }}
    }}
  }
}
