{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/coloringbookify-com/json-schema/coloringbookify-com-book-plan-envelope-schema.json",
  "title": "BookPlanEnvelope",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/coloringbookify-com-openapi.yml#/components/schemas/BookPlanEnvelope",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "required": [
        "type",
        "persistent",
        "plan",
        "credits",
        "generation_request"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "book_plan"
        },
        "persistent": {
          "type": "boolean",
          "const": false
        },
        "plan": {
          "type": "object",
          "additionalProperties": true
        },
        "credits": {
          "type": "object",
          "properties": {
            "required": {
              "type": "integer"
            },
            "available": {
              "type": "integer"
            },
            "sufficient": {
              "type": "boolean"
            }
          }
        },
        "generation_request": {
          "$ref": "#/$defs/BookCreateInput"
        },
        "links": {
          "$ref": "#/$defs/Links"
        }
      }
    }
  },
  "$defs": {
    "BookCreateInput": {
      "type": "object",
      "required": [
        "book"
      ],
      "properties": {
        "book": {
          "type": "object",
          "required": [
            "title",
            "description",
            "pages"
          ],
          "properties": {
            "title": {
              "type": "string"
            },
            "description": {
              "type": "string"
            },
            "additional_instructions": {
              "type": "string"
            },
            "aspect": {
              "type": "string",
              "enum": [
                "square",
                "portrait",
                "landscape"
              ]
            },
            "level": {
              "type": "string"
            },
            "privacy": {
              "type": "string"
            },
            "border_type": {
              "type": "string"
            },
            "outline_weight": {
              "type": "string"
            },
            "cover_style": {
              "type": "string"
            },
            "include_test_color_page": {
              "type": "boolean"
            },
            "language": {
              "type": "string"
            },
            "style_template_key": {
              "type": "string"
            },
            "style_prompt": {
              "type": "string"
            },
            "theme_summary": {
              "type": "string"
            },
            "cover_instructions": {
              "type": "string"
            },
            "character_description": {
              "type": "string"
            },
            "dedication_text": {
              "type": "string"
            },
            "ending_text": {
              "type": "string"
            },
            "reference_image": {
              "type": "string",
              "format": "binary"
            },
            "character_ids": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "pages": {
              "type": "array",
              "minItems": 1,
              "maxItems": 50,
              "items": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "template_data": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          }
        }
      }
    },
    "Links": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    }
  }
}