{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openinherit.org/v3/power-of-appointment.json",
  "title": "Power of Appointment",
  "description": "A testamentary power granting someone the authority to decide how assets or trust interests are distributed. Common in complex wills — the testator grants discretion to an appointee (typically an executor or trustee) to allocate among a defined class of beneficiaries",
  "$comment": "general: appointee can appoint to anyone, including themselves — treated as part of appointee's estate for tax purposes. special: appointee can only appoint among a defined class of beneficiaries. hybrid: a mix — general for some purposes, special for others (e.g. general power exercisable only by will). Powers of appointment are distinct from bequests — a bequest is an immediate gift; a power is discretionary authority to be exercised later",
  "type": "object",
  "required": [ "id", "appointorPersonId", "appointeePersonId", "powerType" ],
  "propertyNames": {
    "pattern": "^(x-inherit-[a-z][a-z0-9-]*|[a-z][a-zA-Z0-9]*)$"
  },
  "properties": {
    "id": {
      "description": "Unique identifier for this power of appointment",
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
      "format": "uuid"
    },
    "appointorPersonId": {
      "description": "The person granting the power (usually the testator)",
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
      "format": "uuid"
    },
    "appointorPersonIdDisplay": {
      "description": "Human-readable display name for the appointor",
      "type": "string",
      "maxLength": 255
    },
    "appointeePersonId": {
      "description": "The person who holds the power and may exercise it (e.g. executor, trustee, spouse)",
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
      "format": "uuid"
    },
    "appointeePersonIdDisplay": {
      "description": "Human-readable display name for the appointee",
      "type": "string",
      "maxLength": 255
    },
    "powerType": {
      "description": "Whether this is a general, special, or hybrid power of appointment",
      "enum": [ "general", "special", "hybrid" ]
    },
    "classOfBeneficiaries": {
      "description": "Natural-language definition of who the appointee may appoint to. Required for special and hybrid powers",
      "examples": [
        "My grandchildren and their descendants",
        "Any registered charity in England and Wales",
        "My spouse and children in such shares as the appointee sees fit"
      ],
      "type": "string",
      "maxLength": 1000
    },
    "scope": {
      "description": "Which assets, trusts, or bequests this power covers. If absent, the power applies to the entire residuary estate",
      "type": "object",
      "properties": {
        "assetIds": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
            "format": "uuid"
          }
        },
        "trustIds": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
            "format": "uuid"
          }
        },
        "bequestIds": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
            "format": "uuid"
          }
        }
      },
      "additionalProperties": false
    },
    "exerciseConditions": {
      "description": "Conditions or limitations on how the power may be exercised",
      "examples": [
        "Exercisable only by will",
        "Exercisable only with the consent of the protector",
        "Must be exercised within 2 years of the testator's death"
      ],
      "type": "string",
      "maxLength": 1000
    },
    "exercisedDate": {
      "description": "Date the power was exercised, if it has been",
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "format": "date"
    },
    "exercisedDocumentId": {
      "description": "Reference to the Document.id recording the exercise of this power",
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
      "format": "uuid"
    },
    "notes": {
      "description": "Free-text notes about this power of appointment",
      "type": "string",
      "maxLength": 2000
    },
    "provenance": {
      "description": "Consolidated provenance metadata",
      "$ref": "common/provenance.json"
    }
  },
  "patternProperties": {
    "^x-inherit-[a-z][a-z0-9-]{1,54}$": {
      "type": "object",
      "maxProperties": 50,
      "propertyNames": {
        "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
        "maxLength": 64
      }
    }
  },
  "unevaluatedProperties": false
}
