{
  "$defs": {
    "ClientProfile": {
      "additionalProperties": false,
      "properties": {
        "annual_media_spend": {
          "minimum": 0,
          "title": "Annual Media Spend",
          "type": "number"
        },
        "annual_revenue": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Annual Revenue"
        },
        "channel_spend": {
          "anyOf": [
            {
              "additionalProperties": {
                "type": "number"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional annual spend per shared-name channel id. When present, maturity's share_spend_with_test_or_cal uses it instead of the share of channels.",
          "title": "Channel Spend"
        },
        "channels": {
          "description": "Shared-name media ids in use.",
          "items": {
            "type": "string"
          },
          "title": "Channels",
          "type": "array"
        },
        "contacts": {
          "description": "Principal ids, never emails in leaves.",
          "items": {
            "type": "string"
          },
          "title": "Contacts",
          "type": "array"
        },
        "currency": {
          "default": "USD",
          "title": "Currency",
          "type": "string"
        },
        "geos": {
          "items": {
            "type": "string"
          },
          "title": "Geos",
          "type": "array"
        },
        "kpis": {
          "items": {
            "type": "string"
          },
          "title": "Kpis",
          "type": "array"
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "vertical": {
          "description": "e.g. apparel, beverage, beauty, insurance.",
          "title": "Vertical",
          "type": "string"
        }
      },
      "required": [
        "name",
        "vertical",
        "annual_media_spend"
      ],
      "title": "ClientProfile",
      "type": "object"
    },
    "ContractTerms": {
      "additionalProperties": false,
      "properties": {
        "licences": {
          "items": {
            "$ref": "#/$defs/Licence"
          },
          "title": "Licences",
          "type": "array"
        },
        "materiality": {
          "$ref": "#/$defs/MaterialityThresholds"
        },
        "min_segment_size": {
          "default": 50,
          "description": "G-PRIV-01 floor from the contract.",
          "minimum": 1,
          "title": "Min Segment Size",
          "type": "integer"
        },
        "on_gate_fail": {
          "anyOf": [
            {
              "enum": [
                "fallback",
                "strict"
              ],
              "type": "string"
            },
            {
              "patternProperties": {
                "^(\\*|G-[A-Z]+-[0-9]{2})$": {
                  "enum": [
                    "fallback",
                    "strict"
                  ],
                  "type": "string"
                }
              },
              "type": "object"
            }
          ],
          "default": "fallback",
          "description": "Account policy (spec \u00a715): a string for every gate or {gate_id: mode, '*': default}. A request never relaxes it.",
          "title": "On Gate Fail"
        },
        "opt_out_channels": {
          "items": {
            "type": "string"
          },
          "title": "Opt Out Channels",
          "type": "array"
        },
        "pool_opt_in": {
          "default": true,
          "title": "Pool Opt In",
          "type": "boolean"
        },
        "query_budget": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "G-PRIV-03 aggregate query budget.",
          "title": "Query Budget"
        },
        "retention_days": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Retention Days"
        },
        "strict_gates": {
          "description": "Deprecated: read as on_gate_fail {gate_id: strict} entries.",
          "items": {
            "type": "string"
          },
          "title": "Strict Gates",
          "type": "array"
        }
      },
      "title": "ContractTerms",
      "type": "object"
    },
    "Licence": {
      "additionalProperties": false,
      "properties": {
        "feed_cost": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Annual feed cost in client currency.",
          "title": "Feed Cost"
        },
        "product": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Product"
        },
        "scope": {
          "default": "client_only",
          "enum": [
            "pooled_use",
            "client_only"
          ],
          "title": "Scope",
          "type": "string"
        },
        "vendor": {
          "title": "Vendor",
          "type": "string"
        }
      },
      "required": [
        "vendor"
      ],
      "title": "Licence",
      "type": "object"
    },
    "MaterialityThresholds": {
      "additionalProperties": false,
      "description": "G-MAT-01 thresholds, per account. All *proposed* (spec \u00a715).",
      "properties": {
        "full_min_weeks_to_reverse": {
          "$ref": "#/$defs/Proposed",
          "default": {
            "proposed": true,
            "source": "\u00a715 'a quarter'",
            "value": 13.0
          }
        },
        "full_review_cost": {
          "$ref": "#/$defs/Proposed",
          "default": {
            "proposed": true,
            "source": "\u00a715",
            "value": 25000.0
          }
        },
        "full_spend": {
          "$ref": "#/$defs/Proposed",
          "default": {
            "proposed": true,
            "source": "\u00a715",
            "value": 2000000.0
          }
        },
        "light_max_weeks_to_reverse": {
          "$ref": "#/$defs/Proposed",
          "default": {
            "proposed": true,
            "source": "\u00a715 'a month'",
            "value": 4.0
          }
        },
        "standard_spend": {
          "$ref": "#/$defs/Proposed",
          "default": {
            "proposed": true,
            "source": "\u00a715",
            "value": 250000.0
          }
        }
      },
      "title": "MaterialityThresholds",
      "type": "object"
    },
    "Proposed": {
      "additionalProperties": false,
      "description": "A threshold value that the spec marks *proposed* (pending the pre-rollout studies).",
      "properties": {
        "proposed": {
          "default": true,
          "title": "Proposed",
          "type": "boolean"
        },
        "source": {
          "default": "",
          "description": "Spec section the value comes from, e.g. '\u00a714'.",
          "title": "Source",
          "type": "string"
        },
        "value": {
          "title": "Value",
          "type": "number"
        }
      },
      "required": [
        "value"
      ],
      "title": "Proposed",
      "type": "object"
    }
  },
  "$id": "https://schemas.ump.dev/v1/client.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "approved_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Governance member (spec \u00a76): approver principal.",
      "title": "Governance ApprovedBy"
    },
    "client_ref": {
      "description": "Salted hash used in pooled tables; client names never pooled.",
      "title": "Client Ref",
      "type": "string"
    },
    "content_hash": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Governance member (spec \u00a76): the artifact content hash.",
      "title": "Governance ContentHash"
    },
    "contract": {
      "$ref": "#/$defs/ContractTerms"
    },
    "created_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Created At"
    },
    "created_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Core client view only: the principal that created the client; not stored. Written by onboarding (`wizard.py`) and core's client view (`services/clients.view`).",
      "title": "Created By"
    },
    "gate_results": {
      "anyOf": [
        {
          "items": {},
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Governance member (spec \u00a76): gate results of the latest run.",
      "title": "Governance GateResults"
    },
    "id": {
      "title": "Id",
      "type": "string"
    },
    "maturity_score": {
      "anyOf": [
        {
          "maximum": 100,
          "minimum": 0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Maturity Score"
    },
    "maturity_stage": {
      "default": "none",
      "enum": [
        "none",
        "foundations",
        "model_live",
        "experimenting",
        "calibrated",
        "reallocating"
      ],
      "title": "Maturity Stage",
      "type": "string"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Core client view only: `profile.name`, served flat; not stored. Written by onboarding (`wizard.py`) and core's client view (`services/clients.view`).",
      "title": "Name"
    },
    "onboarding_terms": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Onboarding contract terms beyond `contract`: clean room, data licences, vendors. Written by onboarding (`wizard.py`) and core's client view (`services/clients.view`).",
      "title": "Onboarding Terms"
    },
    "owner": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Governance member (spec \u00a76): owner principal.",
      "title": "Governance Owner"
    },
    "pool_only": {
      "default": false,
      "description": "Benchmark contributor without portfolio views.",
      "title": "Pool Only",
      "type": "boolean"
    },
    "profile": {
      "$ref": "#/$defs/ClientProfile"
    },
    "revision": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Governance member (spec \u00a76): content revision (spec \u00a77).",
      "title": "Governance Revision"
    },
    "state": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Governance member (spec \u00a76): lifecycle state of the version.",
      "title": "Governance State"
    },
    "submitted_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Governance member (spec \u00a76): submitter principal.",
      "title": "Governance SubmittedBy"
    },
    "updated_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Core client view only: last change, RFC 3339; not stored. Written by onboarding (`wizard.py`) and core's client view (`services/clients.view`).",
      "title": "Updated At"
    },
    "valid_to": {
      "default": null,
      "description": "Governance member (spec \u00a76): end of the validity window (spec \u00a77).",
      "title": "Governance ValidTo"
    },
    "vertical": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Core client view only: `profile.vertical`, served flat; not stored. Written by onboarding (`wizard.py`) and core's client view (`services/clients.view`).",
      "title": "Vertical"
    }
  },
  "required": [
    "id",
    "client_ref",
    "profile"
  ],
  "title": "Client",
  "type": "object"
}
