{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mint-gg/json-schema/mint-gg-model-generation-operation-schema.json",
  "title": "ModelGenerationOperation",
  "description": "A long-running operation acting on one Mint model.",
  "x-generated": "2026-12-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/mint-gg-api-openapi.json#/components/schemas/ModelGenerationOperation",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "object",
    "id",
    "type",
    "generationMode",
    "status",
    "resource",
    "createdAt",
    "updatedAt"
  ],
  "properties": {
    "object": {
      "type": "string",
      "const": "operation",
      "description": "Stable object discriminator."
    },
    "id": {
      "type": "string",
      "description": "Mint operation ID used for polling."
    },
    "type": {
      "type": "string",
      "enum": [
        "model_generation"
      ],
      "description": "The work this operation performs."
    },
    "generationMode": {
      "type": "string",
      "enum": [
        "auto",
        "review"
      ],
      "description": "Workflow mode for this operation."
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "preview_ready",
        "billing_required",
        "succeeded",
        "partially_succeeded",
        "failed",
        "canceled"
      ],
      "description": "Current operation lifecycle status."
    },
    "prompt": {
      "type": "string",
      "description": "Developer-supplied generation brief or revision feedback."
    },
    "generationPreset": {
      "type": "string",
      "enum": [
        "fast",
        "standard",
        "production"
      ],
      "description": "Public generation preset selected for this operation."
    },
    "assets": {
      "$ref": "#/$defs/ModelAssets",
      "description": "Generated model files when available."
    },
    "resource": {
      "description": "The Mint asset created by this operation, or null before the asset exists.",
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "description": "The Mint model affected by this operation.",
          "required": [
            "type",
            "id"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "model",
              "description": "Mint resource type."
            },
            "id": {
              "type": "string",
              "description": "Mint resource ID."
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "billing": {
      "type": "object",
      "additionalProperties": false,
      "description": "The billing action required before this operation can continue.",
      "required": [
        "reason",
        "resource",
        "stage",
        "requiredCredits",
        "actionUrl"
      ],
      "properties": {
        "reason": {
          "type": "string",
          "enum": [
            "subscription_required",
            "past_due",
            "quota_exhausted_upgrade_available",
            "quota_exhausted_top_tier",
            "insufficient_credits",
            "insufficient_completion_credits"
          ]
        },
        "resource": {
          "type": "string",
          "enum": [
            "preview",
            "world",
            "model",
            "asset_pack",
            "material",
            "material_pack",
            "image",
            "audio",
            "video"
          ]
        },
        "stage": {
          "type": "string",
          "enum": [
            "preview",
            "final"
          ]
        },
        "requiredCredits": {
          "type": "number",
          "minimum": 0
        },
        "availableCredits": {
          "type": "number",
          "minimum": 0
        },
        "committedCredits": {
          "type": "number",
          "minimum": 0
        },
        "stageCredits": {
          "type": "number",
          "minimum": 0
        },
        "completionCredits": {
          "type": "number",
          "minimum": 0
        },
        "ctaKind": {
          "type": "string",
          "enum": [
            "view_plans",
            "upgrade_plan",
            "buy_top_up_credits"
          ]
        },
        "actionUrl": {
          "type": "string",
          "format": "uri",
          "description": "Platform billing URL where the developer can add Credits or subscribe."
        }
      }
    },
    "credits": {
      "type": "object",
      "additionalProperties": false,
      "description": "Credit estimate, active reservation, finalized charge, and post-reservation balance for this operation.",
      "required": [
        "estimated",
        "reserved",
        "finalized",
        "availableAfterReservation"
      ],
      "properties": {
        "estimated": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "description": "Current best estimate for all requested stages of this operation."
        },
        "reserved": {
          "type": "number",
          "minimum": 0,
          "description": "Credits currently reserved for unfinished work."
        },
        "finalized": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "description": "Credits finalized for completed provider work, or null while Modeler usage is pending verification."
        },
        "availableAfterReservation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "description": "Account Credits remaining after the latest reservation or settlement update."
        }
      }
    },
    "error": {
      "type": "object",
      "additionalProperties": false,
      "description": "Terminal failure details when the operation failed.",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string",
          "description": "Stable machine-readable failure code."
        },
        "message": {
          "type": "string",
          "description": "Developer-readable failure explanation."
        }
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the operation was created."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the operation last changed."
    },
    "completedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the operation completed."
    },
    "canceledAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the operation was canceled."
    }
  },
  "$defs": {
    "GlbBounds": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "min",
        "max",
        "size",
        "center"
      ],
      "properties": {
        "min": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "number"
          }
        },
        "max": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "number"
          }
        },
        "size": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "number"
          }
        },
        "center": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "number"
          }
        }
      }
    },
    "ModelAssets": {
      "type": "object",
      "description": "Downloadable files and previews for a 3D Model.",
      "required": [
        "fbxUrl",
        "glbUrl",
        "glbSizeBytes",
        "objUrl",
        "optimizedGlbUrl",
        "optimizedGlbSizeBytes",
        "previewImageUrl",
        "stlUrl",
        "thumbnailUrl",
        "usdzUrl",
        "bounds"
      ],
      "properties": {
        "fbxUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "FBX download URL, when available."
        },
        "glbUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Canonical GLB URL for the generated model. For new generations this is Y-up and +Z-forward; it may be a Mint-normalized CDN copy when provider output required orientation correction."
        },
        "glbSizeBytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "description": "GLB size in bytes, when known."
        },
        "objUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "OBJ download URL, when available."
        },
        "optimizedGlbUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Optimized GLB download URL, when available."
        },
        "optimizedGlbSizeBytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "description": "Optimized GLB size in bytes, when known."
        },
        "previewImageUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "3D Model Preview image URL, when available."
        },
        "stlUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "STL download URL, when available."
        },
        "thumbnailUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "3D Model thumbnail URL, when available."
        },
        "usdzUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "USDZ download URL, when available."
        },
        "bounds": {
          "description": "World-space GLB bounds in meters, or null for legacy models that have not been measured.",
          "oneOf": [
            {
              "$ref": "#/$defs/GlbBounds"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}