{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/kdpcoloringbook-com/json-schema/kdpcoloringbook-com-generate-request-schema.json",
  "title": "GenerateRequest",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kdpcoloringbook-com-openapi.json#/components/schemas/GenerateRequest",
  "properties": {
    "theme": {
      "type": "string",
      "maxLength": 200,
      "minLength": 1,
      "title": "Theme"
    },
    "title": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 120,
          "minLength": 1
        },
        {
          "type": "null"
        }
      ],
      "title": "Title"
    },
    "length": {
      "$ref": "#/$defs/BookLength"
    },
    "pages": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 60.0,
          "minimum": 3.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Pages"
    },
    "style_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Style Id"
    },
    "custom_style": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2000,
          "minLength": 3
        },
        {
          "type": "null"
        }
      ],
      "title": "Custom Style"
    },
    "reference_prompt": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2000
        },
        {
          "type": "null"
        }
      ],
      "title": "Reference Prompt"
    },
    "distribution_type": {
      "type": "string",
      "enum": [
        "progressive",
        "bold_and_easy",
        "cute_and_cozy"
      ],
      "title": "Distribution Type",
      "default": "progressive"
    },
    "character_count": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 4.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Character Count"
    },
    "language": {
      "type": "string",
      "enum": [
        "en",
        "es",
        "de",
        "fr",
        "it",
        "pt"
      ],
      "title": "Language",
      "default": "en"
    },
    "purpose": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "kdp",
            "gift",
            "other"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Purpose"
    },
    "style_description": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 4000
        },
        {
          "type": "null"
        }
      ],
      "title": "Style Description"
    },
    "allow_text": {
      "type": "boolean",
      "title": "Allow Text",
      "default": false
    },
    "distribution": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/DistributionRange"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Distribution"
    },
    "user_rules": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 1000
        },
        {
          "type": "null"
        }
      ],
      "title": "User Rules"
    },
    "include_copyright": {
      "type": "boolean",
      "title": "Include Copyright",
      "default": false
    },
    "include_tips": {
      "type": "boolean",
      "title": "Include Tips",
      "default": false
    },
    "include_review": {
      "type": "boolean",
      "title": "Include Review",
      "default": false
    },
    "include_test": {
      "type": "boolean",
      "title": "Include Test",
      "default": false
    }
  },
  "type": "object",
  "required": [
    "theme",
    "length"
  ],
  "$defs": {
    "BookLength": {
      "type": "string",
      "enum": [
        "test",
        "short",
        "medium",
        "long"
      ],
      "title": "BookLength"
    },
    "DistributionRange": {
      "properties": {
        "start_page": {
          "type": "integer",
          "minimum": 1.0,
          "title": "Start Page"
        },
        "end_page": {
          "type": "integer",
          "minimum": 1.0,
          "title": "End Page"
        },
        "theme": {
          "type": "string",
          "maxLength": 120,
          "minLength": 1,
          "title": "Theme"
        },
        "description": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 600
            },
            {
              "type": "null"
            }
          ],
          "title": "Description"
        }
      },
      "type": "object",
      "required": [
        "start_page",
        "end_page",
        "theme"
      ],
      "title": "DistributionRange",
      "description": "One contiguous section of the book's page plan.\n\nShared contract with the frontend: ranges are contiguous and cover pages\n``1..config.pages`` exactly. ``theme`` is a short user-facing label (in the\nuser's language); ``description`` is an optional English brief that is fed\nto the page-prompt generator."
    }
  }
}