{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dealboard/json-schema/dealboard-deal-schema.json",
  "title": "Deal",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dealboard-openapi.json#/components/schemas/Deal",
  "type": "object",
  "required": [
    "id",
    "boardId",
    "name",
    "company",
    "companyWebsite",
    "amountCents",
    "currency",
    "stage",
    "ownerId",
    "ownerName",
    "labels",
    "primaryContact",
    "keyTerms",
    "createdAt",
    "updatedAt",
    "stageEnteredAt",
    "commitmentAt",
    "wonAt",
    "deadAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "boardId": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "company": {
      "type": [
        "string",
        "null"
      ]
    },
    "companyWebsite": {
      "type": [
        "string",
        "null"
      ]
    },
    "amountCents": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Deal value in minor currency units (cents). No floats."
    },
    "currency": {
      "type": "string",
      "enum": [
        "USD",
        "EUR",
        "GBP",
        "CAD",
        "AUD",
        "JPY",
        "INR"
      ]
    },
    "stage": {
      "$ref": "#/$defs/Stage"
    },
    "ownerId": {
      "type": "string",
      "format": "uuid"
    },
    "ownerName": {
      "type": [
        "string",
        "null"
      ]
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "primaryContact": {
      "type": "object",
      "required": [
        "name",
        "title",
        "email",
        "phone",
        "linkedin"
      ],
      "properties": {
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "title": {
          "type": [
            "string",
            "null"
          ]
        },
        "email": {
          "type": [
            "string",
            "null"
          ]
        },
        "phone": {
          "type": [
            "string",
            "null"
          ]
        },
        "linkedin": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "keyTerms": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "stageEnteredAt": {
      "type": "string",
      "format": "date-time"
    },
    "commitmentAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "wonAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "deadAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  },
  "$defs": {
    "Stage": {
      "type": "object",
      "required": [
        "id",
        "name",
        "region",
        "isAnchor"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Stage id (per-board). Use this in `stageId` / `toStageId` / `stageFilter` write paths."
        },
        "name": {
          "type": "string",
          "description": "User-facing stage name. Editable per-board."
        },
        "region": {
          "type": "string",
          "enum": [
            "early",
            "anchor",
            "late",
            "won",
            "dead"
          ],
          "description": "Semantic bucket: early/late are 1..6 user-customizable stages each; anchor is the single per-board \"things got serious\" milestone; won/dead are immutable terminals."
        },
        "isAnchor": {
          "type": "boolean",
          "description": "Convenience flag — `region === \"anchor\"`."
        }
      }
    }
  }
}