{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pencil-ink/json-schema/pencil-ink-customer-sales-update-schema.json",
  "title": "CustomerSalesUpdate",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pencil-ink-openapi.yml#/components/schemas/CustomerSalesUpdate",
  "type": "object",
  "properties": {
    "salesId": {
      "type": "string"
    },
    "expectedRevision": {
      "type": "number"
    },
    "patch": {
      "type": "object",
      "additionalProperties": false,
      "description": "Omit fields to preserve them; null clears nullable fields. Money is an integer in currency minor units (USD cents, JPY yen). Unknown value is null; zero is known zero.",
      "properties": {
        "stage": {
          "type": "string",
          "enum": [
            "new",
            "contacted",
            "qualified",
            "proposal",
            "negotiation"
          ]
        },
        "ownerUserId": {
          "type": [
            "string",
            "null"
          ],
          "description": "Eligible internal user id from get_customer_sales_capabilities; null clears."
        },
        "primaryContactId": {
          "type": [
            "string",
            "null"
          ],
          "description": "Contact id belonging to this company; null clears."
        },
        "estimatedValueMinor": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ],
          "description": "Non-negative safe integer in currency minor units; null clears."
        },
        "currency": {
          "type": "string",
          "enum": [
            "USD",
            "EUR",
            "GBP",
            "CAD",
            "AUD",
            "JPY"
          ],
          "description": "Changing currency requires restating or clearing estimatedValueMinor."
        },
        "nextStep": {
          "type": [
            "string",
            "null"
          ],
          "description": "Internal next action, at most 500 characters; null clears action and its omitted due date."
        },
        "nextStepDueDate": {
          "type": [
            "string",
            "null"
          ],
          "description": "Calendar date YYYY-MM-DD; requires a nextStep; null clears."
        },
        "expectedCloseDate": {
          "type": [
            "string",
            "null"
          ],
          "description": "Calendar date YYYY-MM-DD; null clears."
        },
        "salesNotes": {
          "type": [
            "string",
            "null"
          ],
          "description": "Internal sales notes, at most 5000 characters; null clears."
        }
      }
    },
    "idempotencyKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Unique retry key. Reuse with exactly the same arguments after an uncertain result. Never reuse for a different change."
    }
  },
  "required": [
    "salesId",
    "expectedRevision",
    "patch",
    "idempotencyKey"
  ],
  "additionalProperties": false
}