{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sprixen-com/json-schema/sprixen-com-create-generation-dto-schema.json",
  "title": "CreateGenerationDto",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sprixen-com-openapi.json#/components/schemas/CreateGenerationDto",
  "type": "object",
  "properties": {
    "prompt": {
      "type": "string",
      "description": "Describe the sprite to generate. Max 6000 characters."
    },
    "projectId": {
      "type": "string",
      "description": "Project ID to use style config from (optional)"
    },
    "type": {
      "type": "string",
      "enum": [
        "sprite",
        "variation"
      ],
      "default": "sprite"
    },
    "referenceImageUrl": {
      "type": "string",
      "description": "Optional reference image URL or path to guide style (passed to Gemini)"
    },
    "webhookUrl": {
      "type": "string",
      "description": "Optional webhook URL — receives a POST when generation completes or fails"
    },
    "variantCount": {
      "type": "number",
      "description": "Number of sprite variants to generate (1-3). Each variant costs 2 credits. Locked to 1 when chainAnimation is used.",
      "default": 1,
      "minimum": 1,
      "maximum": 3
    },
    "chainAnimation": {
      "description": "When provided, the sprite generation automatically chains into an animation job. Requires projectId to be set. Costs 6 credits instead of 2.",
      "allOf": [
        {
          "$ref": "#/$defs/ChainAnimationDto"
        }
      ]
    },
    "chainAnimations": {
      "description": "Multiple animation types to chain after sprite completes. Use instead of chainAnimation when you want multiple animations. Requires projectId. Costs 4 credits per animation.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/ChainAnimationDto"
      }
    },
    "skipBgRemoval": {
      "type": "boolean",
      "description": "Skip background removal (RMBG-2.0). Use for full-scene images like game backgrounds where bg removal would damage the image.",
      "default": false
    },
    "resolution": {
      "type": "string",
      "description": "Override resolution for this generation (e.g. \"256x256\"). If not provided, uses the project resolution or the default 128x128. Format: \"WIDTHxHEIGHT\" with each side between 8 and 4096, e.g. \"256x256\" or \"28x32\"."
    },
    "noBase": {
      "type": "boolean",
      "description": "When true, adds \"NO base, NO pedestal, NO ground plane, NO ground shadow\" to the prompt. Useful for character sprites that should float freely without any surface underneath.",
      "default": false
    },
    "packItems": {
      "description": "For pack generation: list of items to generate in a single sheet. Each item becomes a separate sprite. Max 8 items.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "packType": {
      "type": "string",
      "description": "For pack generation: prompt contract preset for generic items/props, ability icons, or HUD/UI pieces.",
      "enum": [
        "items_props",
        "ability_icons",
        "hud_ui"
      ]
    },
    "pixelPerfect": {
      "type": "string",
      "description": "Pixel Perfect resize mode for this generation (overrides project setting). \"auto\" (recommended): system picks the right algorithm based on artStyle + resolution. \"on\": forces crispy nearest-neighbor kernel (retro pixel art, Gungeon/NES-style). \"off\": forces smooth Lanczos kernel (cartoon, anime, higher-res art). IMPORTANT: nearest-neighbor is NOT universally \"better\" - it destroys fine detail at higher resolutions. Use \"auto\" unless you have a specific reason.",
      "enum": [
        "auto",
        "on",
        "off"
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "$defs": {
    "ChainAnimationDto": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "idle",
            "walk",
            "run",
            "attack",
            "jump",
            "death",
            "hurt",
            "custom"
          ],
          "description": "Animation type to generate automatically after sprite completes"
        },
        "frameCount": {
          "type": "number",
          "description": "Number of frames (defaults per type if omitted)"
        },
        "fps": {
          "type": "number",
          "description": "Frames per second (default 12)"
        },
        "direction": {
          "type": "string",
          "enum": [
            "right",
            "left",
            "up",
            "down",
            "up-right",
            "up-left",
            "down-right",
            "down-left"
          ],
          "description": "Facing direction for top-down/isometric games. When omitted Gemini picks a default (typically right side view). Use this with `chainAnimations: []` to chain the same animation type in multiple directions."
        },
        "resolution": {
          "type": "string",
          "description": "Override resolution for this chained animation (e.g. \"28x32\"). If omitted, falls back to project resolution. Match this with the sprite's resolution (when CreateGenerationDto.resolution was set) so the animation preserves the same chunky pixel-art style as the base sprite instead of being upscaled. Format: \"WIDTHxHEIGHT\" with each side between 8 and 4096, e.g. \"256x256\" or \"28x32\"."
        },
        "idlePreset": {
          "type": "string",
          "enum": [
            "breath",
            "lively",
            "looking",
            "item"
          ],
          "description": "Pre-baked idle style. Only honored when type=\"idle\". Translates to a customDescription internally."
        },
        "quality": {
          "type": "string",
          "enum": [
            "standard",
            "premium"
          ],
          "description": "Animation quality. \"standard\" is a Gemini sprite sheet. \"premium\" produces a richer, higher-frame animation (costs more credits). Defaults to \"standard\"."
        }
      },
      "required": [
        "type"
      ]
    }
  }
}