=== META ===
{
  "id": "GTPX-PLAN-MODEL",
  "title": "GTPX Plan Model",
  "version": "0.1.0",
  "status": "draft",
  "updated": "2026-04-25",
  "authority": "04_contract/GTPX-PLAN-MODEL.gtpx",
  "type": "contract_plan_model",
  "project": "GTPX",
  "depends_on": [
    "03_language/GTPX-ENUMS.gtpx",
    "04_contract/GTPX-CONTRACT-MODEL.gtpx",
    "09_runtime/GTPX-AUDIT-MODEL.gtpx"
  ]
}

=== DATA ===
{
  "purpose": "Defines the canonical technical model for how a plan exists, is versioned, validated, hashed, and changed inside the AVH Development Platform.",

  "definition": "A plan is a structured, versioned, hashable and auditable canonical JSON payload that defines the state, rules, objectives and constraints of an entity.",

  "scope": {
    "applies_to": [
      "GTPX",
      "AVHS",
      "Synarch",
      "Projects",
      "Modules",
      "Services",
      "Business"
    ],
    "does_not_define": [
      "business_logic",
      "runtime_implementation",
      "database_schema",
      "api_routes",
      "ui_behavior"
    ]
  },

  "canonical_storage_policy": {
    "canonical_plan_form": "JSON payload",
    "canonical_storage": "database",
    "files_are_authoritative": false,
    "files_allowed_for": [
      "import",
      "export",
      "debugging",
      "human_review",
      "bundle_generation"
    ]
  },

  "plan_identity": {
    "required_fields": [
      "id",
      "entity_id",
      "version",
      "status",
      "payload",
      "hash",
      "created_at",
      "created_by",
      "parent_version_id"
    ]
  },

  "field_definitions": {
    "id": "Unique identifier of the plan version.",
    "entity_id": "Identifier of the entity this plan belongs to.",
    "version": "Version of the plan.",
    "status": "Lifecycle status of the plan, using plan_status from GTPX-ENUMS.",
    "payload": "Canonical JSON content of the plan.",
    "hash": "Deterministic hash of the canonical payload.",
    "created_at": "Timestamp when the plan version was created.",
    "created_by": "Identifier of the user or process that created the plan version.",
    "parent_version_id": "Reference to the previous plan version, or null for the first version."
  },

  "payload_minimum_structure": {
    "required_sections": [
      "structure",
      "rules",
      "constraints",
      "objectives"
    ],
    "section_definitions": {
      "structure": "Defines the internal structure of the planned entity.",
      "rules": "Defines allowed and forbidden behavior.",
      "constraints": "Defines technical, operational, legal or process limitations.",
      "objectives": "Defines goals and intended outcomes."
    }
  },

  "versioning_policy": {
    "overwrite_existing_versions": false,
    "new_change_creates_new_version": true,
    "parent_version_required_after_first_version": true,
    "version_chain_must_be_reconstructible": true
  },

  "hash_policy": {
    "hash_required": true,
    "hash_algorithm": "SHA-256",
    "hash_target": "canonical_payload",
    "hash_mismatch_blocks_commit": true
  },

  "change_policy": {
    "direct_edit_forbidden": true,
    "change_request_required": true,
    "analysis_required": true,
    "dry_run_required": true,
    "patch_required": true,
    "commit_required": true,
    "audit_required": true
  }
}

=== RULES ===
{
  "plan_model_is_global": true,
  "synarch_uses_plan_model_but_does_not_define_it": true,
  "dev_manager_uses_plan_model_for_development_control": true,
  "all_plan_changes_must_follow_change_policy": true,
  "payload_must_be_valid_json": true,
  "payload_must_include_minimum_structure": true,
  "plan_status_must_use_gtpx_enums": true,
  "hash_must_match_payload": true,
  "old_versions_must_not_be_overwritten": true
}

=== STATUS ===
{
  "state": "draft",
  "open_questions": [
    "Define exact canonical JSON normalization rules before hashing",
    "Define exact payload schema per entity type",
    "Define whether version uses semver or monotonic internal versioning",
    "Define plan import/export format"
  ],
  "next_step": "Register GTPX-PLAN-MODEL in INDEX and REGISTRY."
}