{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/playablegift-com/json-schema/playablegift-com-create-gift-schema.json",
  "title": "CreateGift",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/playablegift-com-openapi.json#/components/schemas/CreateGift",
  "type": "object",
  "properties": {
    "recipient": {
      "type": "string",
      "minLength": 1,
      "maxLength": 60
    },
    "sender": {
      "type": "string",
      "minLength": 1,
      "maxLength": 60
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "concept": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000
    },
    "occasion": {
      "default": "just-because",
      "type": "string",
      "enum": [
        "birthday",
        "anniversary",
        "thank-you",
        "just-because"
      ]
    },
    "theme": {
      "default": "sunshine",
      "type": "string",
      "enum": [
        "sunshine",
        "midnight",
        "rose"
      ]
    },
    "message": {
      "default": "",
      "type": "string",
      "maxLength": 2000
    },
    "recipientEmail": {
      "default": "",
      "anyOf": [
        {
          "type": "string",
          "maxLength": 254,
          "format": "email",
          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        {
          "type": "string",
          "const": ""
        }
      ]
    },
    "game": {
      "type": "object",
      "properties": {
        "html": {
          "type": "string",
          "minLength": 100,
          "maxLength": 120000,
          "description": "Complete self-contained HTML game with inline CSS/JS and embedded assets. External dependencies, fetches, forms, popups, payments and personal-data collection are prohibited. Supported controls are canvas or DOM with keyboard and touch input. The game includes restart and clear win/lose states. Completion notification is parent.postMessage({type:'playablegift:complete'}, '*')."
        }
      },
      "required": [
        "html"
      ],
      "additionalProperties": false
    },
    "idempotencyKey": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    }
  },
  "required": [
    "recipient",
    "sender",
    "title",
    "concept",
    "game",
    "idempotencyKey"
  ],
  "additionalProperties": false
}