{
  "$defs": {
    "AppliesTo": {
      "additionalProperties": false,
      "description": "Scope beside the estimand: compared by ``G-EST-02`` like the seven fields.",
      "properties": {
        "client_id": {
          "title": "Client Id",
          "type": "string"
        },
        "geo_ids": {
          "items": {
            "type": "string"
          },
          "title": "Geo Ids",
          "type": "array"
        },
        "kpi": {
          "title": "Kpi",
          "type": "string"
        },
        "media_ids": {
          "items": {
            "type": "string"
          },
          "title": "Media Ids",
          "type": "array"
        },
        "period": {
          "$ref": "#/$defs/Period"
        },
        "time_id": {
          "description": "Spec \u00a74 time registry entry ID.",
          "title": "Time Id",
          "type": "string"
        }
      },
      "title": "AppliesTo",
      "type": "object"
    },
    "DependenceDeclaration": {
      "additionalProperties": false,
      "properties": {
        "assumption": {
          "anyOf": [
            {
              "enum": [
                "copula",
                "independence"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Required when kind is declared_assumption.",
          "title": "Assumption"
        },
        "kind": {
          "enum": [
            "joint_draws",
            "joint_gaussian",
            "declared_assumption",
            "per_channel",
            "none"
          ],
          "title": "Kind",
          "type": "string"
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Note"
        }
      },
      "required": [
        "kind"
      ],
      "title": "DependenceDeclaration",
      "type": "object"
    },
    "Estimand": {
      "additionalProperties": false,
      "description": "The seven fields plus ``applies_to`` and the registered optional members. ``None`` (written\n``\"undeclared\"``) means undeclared.",
      "properties": {
        "applies_to": {
          "$ref": "#/$defs/AppliesTo"
        },
        "baseline": {
          "anyOf": [
            {
              "enum": [
                "zero_spend",
                "current_plan",
                "reduced_spend",
                "control_counterfactual"
              ],
              "type": "string"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ],
          "title": "Baseline"
        },
        "baseline_x": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ],
          "description": "x of reduced_spend(x): spend at x times the current plan. Required with baseline reduced_spend; ignored otherwise (spec \u00a75).",
          "title": "Baseline X"
        },
        "field_status": {
          "additionalProperties": {
            "enum": [
              "declared",
              "undeclared",
              "assumed"
            ],
            "type": "string"
          },
          "title": "Field Status",
          "type": "object"
        },
        "horizon": {
          "anyOf": [
            {
              "$ref": "#/$defs/Horizon"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ]
        },
        "interval": {
          "anyOf": [
            {
              "$ref": "#/$defs/IntervalSpec"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ]
        },
        "intervention": {
          "anyOf": [
            {
              "$ref": "#/$defs/Intervention"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ]
        },
        "metric_family": {
          "description": "sales_return, brand_awareness, ...",
          "title": "Metric Family",
          "type": "string"
        },
        "point_rule": {
          "anyOf": [
            {
              "enum": [
                "posterior_mean",
                "posterior_median",
                "map",
                "estimator_point"
              ],
              "type": "string"
            },
            {
              "$ref": "#/$defs/PointRuleSpec"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ],
          "title": "Point Rule"
        },
        "registry_id": {
          "description": "Registered estimand id, e.g. E-BM-AVG-ROI.",
          "title": "Registry Id",
          "type": "string"
        },
        "schema_version": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ],
          "description": "Estimand registry version, e.g. est-registry/1.2.0. No default.",
          "title": "Schema Version"
        },
        "unit": {
          "anyOf": [
            {
              "$ref": "#/$defs/Unit"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ]
        }
      },
      "title": "Estimand",
      "type": "object"
    },
    "Horizon": {
      "additionalProperties": false,
      "description": "Time over which the effect is counted. ``{type: window, anchor: fit}`` is the model's fit window:\na template written before any fit (an adapter's metadata) leaves ``weeks`` absent, and every\nquantity a fit produces states ``weeks`` (spec \u00a75, \"Fit-window horizon\"). ``weeks`` is never null.",
      "properties": {
        "anchor": {
          "const": "fit",
          "description": "Spec \u00a75: `fit` means the window is the model's fit window. Absent means the window counts from the start of the intervention.",
          "title": "Anchor",
          "type": "string"
        },
        "threshold": {
          "description": "Decay threshold for total_to_decay.",
          "title": "Threshold",
          "type": "number"
        },
        "type": {
          "enum": [
            "immediate",
            "window",
            "total_to_decay",
            "total"
          ],
          "title": "Type",
          "type": "string"
        },
        "weeks": {
          "description": "Weeks counted. Absent only on a fit-window template.",
          "minimum": 0,
          "title": "Weeks",
          "type": "integer"
        }
      },
      "required": [
        "type"
      ],
      "title": "Horizon",
      "type": "object"
    },
    "IntervalSpec": {
      "additionalProperties": false,
      "properties": {
        "level": {
          "exclusiveMaximum": 1,
          "exclusiveMinimum": 0,
          "title": "Level",
          "type": "number"
        },
        "method": {
          "enum": [
            "hdi",
            "eti",
            "confidence",
            "bootstrap_pct",
            "placebo",
            "envelope",
            "imputed"
          ],
          "title": "Method",
          "type": "string"
        }
      },
      "required": [
        "method",
        "level"
      ],
      "title": "IntervalSpec",
      "type": "object"
    },
    "Intervention": {
      "additionalProperties": false,
      "properties": {
        "arms": {
          "items": {
            "type": "string"
          },
          "title": "Arms",
          "type": "array"
        },
        "population": {
          "anyOf": [
            {
              "enum": [
                "itt",
                "exposed",
                "geo_set"
              ],
              "type": "string"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ],
          "title": "Population"
        },
        "size": {
          "description": "e.g. -0.30 for a 30% cut, 0.10 for +10%.",
          "title": "Size",
          "type": "number"
        },
        "size_kind": {
          "anyOf": [
            {
              "enum": [
                "absolute",
                "relative"
              ],
              "type": "string"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ],
          "description": "How to read size: relative (a fraction of current spend) or absolute (spend in unit.currency). Required when size is present; no default (spec \u00a75).",
          "title": "Size Kind"
        },
        "type": {
          "enum": [
            "remove_all",
            "scale",
            "add",
            "marginal"
          ],
          "title": "Type",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "title": "Intervention",
      "type": "object"
    },
    "Note": {
      "additionalProperties": false,
      "description": "Informational or warning note (e.g. ``ENGINE_STUB``, ``NOT_IMPLEMENTED_IN_POC``).",
      "properties": {
        "code": {
          "pattern": "^[A-Z][A-Z0-9_]*$",
          "title": "Code",
          "type": "string"
        },
        "gate": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Gate"
        },
        "message": {
          "title": "Message",
          "type": "string"
        },
        "severity": {
          "default": "info",
          "enum": [
            "info",
            "warn"
          ],
          "title": "Severity",
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "title": "Note",
      "type": "object"
    },
    "Period": {
      "additionalProperties": false,
      "description": "Calendar dates, half-open ``[start, end)`` (spec \u00a74).",
      "properties": {
        "end": {
          "format": "date",
          "title": "End",
          "type": "string"
        },
        "start": {
          "format": "date",
          "title": "Start",
          "type": "string"
        }
      },
      "title": "Period",
      "type": "object"
    },
    "PointRuleSpec": {
      "additionalProperties": false,
      "description": "``{rule, scale}`` form of ``point_rule`` (spec \u00a75): ``scale`` is ``identity`` or ``log``.",
      "properties": {
        "rule": {
          "enum": [
            "posterior_mean",
            "posterior_median",
            "map",
            "estimator_point"
          ],
          "title": "Rule",
          "type": "string"
        },
        "scale": {
          "enum": [
            "identity",
            "log"
          ],
          "title": "Scale",
          "type": "string"
        }
      },
      "required": [
        "rule",
        "scale"
      ],
      "title": "PointRuleSpec",
      "type": "object"
    },
    "Unit": {
      "additionalProperties": false,
      "description": "``per`` is ``spend``, ``impression`` or ``absolute``. ``currency`` (ISO 4217) is required with\n``per: spend`` and allowed with ``per: absolute`` (a money KPI); there its absence means the KPI is\nnot money. Build a spend unit with ``spend_unit(currency)``.",
      "properties": {
        "cost_basis": {
          "anyOf": [
            {
              "enum": [
                "net",
                "gross"
              ],
              "type": "string"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ],
          "title": "Cost Basis"
        },
        "currency": {
          "anyOf": [
            {
              "pattern": "^[A-Z]{3}$",
              "type": "string"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ],
          "description": "ISO 4217 alpha-3; required with per: spend.",
          "title": "Currency"
        },
        "kpi": {
          "title": "Kpi",
          "type": "string"
        },
        "per": {
          "anyOf": [
            {
              "enum": [
                "spend",
                "impression",
                "absolute"
              ],
              "type": "string"
            },
            {
              "const": "undeclared",
              "type": "string"
            }
          ],
          "description": "Denominator: spend, impression or absolute (spec \u00a75).",
          "title": "Per"
        }
      },
      "required": [
        "kpi"
      ],
      "title": "Unit",
      "type": "object"
    }
  },
  "$id": "https://schemas.ump.dev/v1/adapter-metadata.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "adapter_kind": {
      "anyOf": [
        {
          "enum": [
            "model",
            "experiment",
            "planner",
            "negative_control"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "model | experiment | planner | negative_control. None means infer it (see infer_adapter_kind). Experiments are not a model family.",
      "title": "Adapter Kind"
    },
    "adapter_version": {
      "default": "0.1.0",
      "title": "Adapter Version",
      "type": "string"
    },
    "dependence": {
      "$ref": "#/$defs/DependenceDeclaration"
    },
    "deterministic_given_seed": {
      "default": true,
      "title": "Deterministic Given Seed",
      "type": "boolean"
    },
    "engine": {
      "title": "Engine",
      "type": "string"
    },
    "engine_version": {
      "title": "Engine Version",
      "type": "string"
    },
    "estimands_supported": {
      "additionalProperties": {
        "$ref": "#/$defs/Estimand"
      },
      "title": "Estimands Supported",
      "type": "object"
    },
    "family": {
      "default": "media_mix",
      "enum": [
        "media_mix",
        "audience",
        "reach_frequency",
        "attribution",
        "brand_funnel",
        "forecasting",
        "creative",
        "media_tracking",
        "effectiveness_index"
      ],
      "title": "Family",
      "type": "string"
    },
    "inference": {
      "default": "custom",
      "title": "Inference",
      "type": "string"
    },
    "licence": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Licence"
    },
    "notes": {
      "items": {
        "$ref": "#/$defs/Note"
      },
      "title": "Notes",
      "type": "array"
    },
    "operations": {
      "additionalProperties": {
        "enum": [
          "built_in",
          "computed_by_ump",
          "unavailable"
        ],
        "type": "string"
      },
      "description": "fit/score/response_curve/marginal_return/decompose/optimize/calibrate/update -> support. Every one is named: a request left out reads as unavailable (spec \u00a78).",
      "title": "Operations",
      "type": "object"
    },
    "representation": {
      "default": "draws",
      "title": "Representation",
      "type": "string"
    },
    "role": {
      "default": "candidate",
      "enum": [
        "candidate",
        "negative_control",
        "positive_control"
      ],
      "title": "Role",
      "type": "string"
    },
    "spec_version": {
      "default": "2.3.0-draft",
      "title": "Spec Version",
      "type": "string"
    },
    "stub": {
      "default": false,
      "title": "Stub",
      "type": "boolean"
    },
    "supported_spec_versions": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Spec \u00a721 negotiation: the spec versions this adapter reads and writes.",
      "title": "Supported Spec Versions"
    },
    "tiers_produced": {
      "items": {
        "enum": [
          "A",
          "B",
          "C",
          "D",
          "X"
        ],
        "type": "string"
      },
      "title": "Tiers Produced",
      "type": "array"
    }
  },
  "required": [
    "engine",
    "engine_version",
    "tiers_produced",
    "operations",
    "dependence"
  ],
  "title": "AdapterMetadata",
  "type": "object"
}
