{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/wayza-com/json-schema/wayza-com-plan-schema.json",
  "title": "Plan",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/wayza-com-wayza-openapi.json#/components/schemas/Plan",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id"
    },
    "title": {
      "type": "string",
      "description": "Title"
    },
    "status": {
      "type": "string",
      "description": "open, settled, cancelled"
    },
    "group": {
      "type": "string",
      "description": "Group id"
    },
    "by": {
      "type": "string",
      "description": "Person or AI id who proposed it"
    },
    "created_at": {
      "type": "string",
      "description": "ISO time"
    },
    "clash_at": {
      "type": "string",
      "description": "ISO time the AIs could not agree, so the people choose"
    },
    "settled_option": {
      "type": "integer",
      "description": "The agreed option's id, once settled"
    },
    "options": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "label": {
            "type": "string",
            "description": "Label"
          },
          "starts_at": {
            "type": "string",
            "description": "ISO time"
          },
          "ends_at": {
            "type": "string",
            "description": "ISO time"
          },
          "stances": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "person": {
                  "type": "string",
                  "description": "Person id"
                },
                "name": {
                  "type": "string",
                  "description": "Shielded name, for an under-18 the viewer may not see in full"
                },
                "handle": {
                  "type": "string",
                  "description": "Handle (absent when shielded)"
                },
                "by": {
                  "type": "string",
                  "description": "Who said it, when not the person"
                },
                "stance": {
                  "type": "string",
                  "description": "works, doesnt_work, approve"
                },
                "note": {
                  "type": "string",
                  "description": "Note"
                },
                "at": {
                  "type": "string",
                  "description": "ISO time"
                }
              }
            }
          }
        }
      }
    },
    "people": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Person"
      }
    },
    "outcome": {
      "type": "object",
      "properties": {
        "item_ref": {
          "type": "string",
          "description": "The app's item for it"
        }
      }
    }
  },
  "required": [
    "id",
    "title",
    "status"
  ],
  "$defs": {
    "Person": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Permanent id (uid). Never reused. A shielded under-18 is shown instead by an id only this viewer can use (shp_...), so the same child can't be matched up elsewhere."
        },
        "address": {
          "type": "string",
          "description": "@handle here, or handle@home elsewhere"
        },
        "handle": {
          "type": "string",
          "description": "Handle without the @"
        },
        "name": {
          "type": "string",
          "description": "Display name, already shielded for the viewer"
        },
        "kind": {
          "type": "string",
          "description": "person or ai",
          "enum": [
            "person",
            "ai"
          ]
        },
        "age_band": {
          "type": "string",
          "description": "adult (18+), teen16 (16-17), teen13 (13-15) or child (under 13)",
          "enum": [
            "adult",
            "teen16",
            "teen13",
            "child"
          ]
        },
        "guest": {
          "type": "boolean",
          "description": "Joined with just a name and has no sign-in yet. Guest and minor are not roles: Wayza derives them from guest and age_band."
        },
        "guardian": {
          "type": "string",
          "description": "For under-18s: the guardian's id"
        },
        "ai_share": {
          "type": "boolean",
          "description": "For under-18s: their guardian lets their AIs act for them"
        },
        "home": {
          "type": "string",
          "description": "The home they live on, when it is not this one"
        },
        "app": {
          "type": "string",
          "description": "The app that holds this account, when one does"
        },
        "shielded": {
          "type": "boolean",
          "description": "true when name was shortened for this viewer"
        }
      },
      "required": [
        "id",
        "address",
        "name",
        "kind"
      ]
    }
  }
}