{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/centaur-labs/json-schema/centaur-labs-database-existing-problem-schema.json",
  "title": "DatabaseExistingProblem",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/centaur-labs-create-and-manage-cases-api-openapi.yml#/components/schemas/DatabaseExistingProblem",
  "properties": {
    "problem_parent": {
      "anyOf": [
        {
          "$ref": "#/$defs/ProblemParent"
        },
        {
          "type": "null"
        }
      ]
    },
    "problem_properties": {
      "$ref": "#/$defs/DatabaseProblemProperties"
    },
    "frames": {
      "items": {
        "$ref": "#/$defs/DatabaseFrame"
      },
      "type": "array",
      "minItems": 1,
      "title": "Frames",
      "unique_items": true
    },
    "problem_tags": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/ProblemTags"
          },
          "type": "array",
          "minLength": 1,
          "unique_items": true
        },
        {
          "type": "null"
        }
      ],
      "title": "Problem Tags"
    },
    "topic_id": {
      "type": "integer",
      "title": "Topic Id"
    },
    "problem_id": {
      "type": "integer",
      "title": "Problem Id"
    }
  },
  "type": "object",
  "required": [
    "frames",
    "topic_id",
    "problem_id"
  ],
  "$defs": {
    "AnswerClass": {
      "additionalProperties": true,
      "type": "object"
    },
    "AssetTags": {
      "properties": {
        "tag_text": {
          "type": "string",
          "title": "Tag Text"
        },
        "customer_data_tag_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Customer Data Tag Id"
        },
        "organization_id": {
          "type": "integer",
          "title": "Organization Id"
        },
        "asset_tag_created_by_customer_id": {
          "type": "integer",
          "title": "Asset Tag Created By Customer Id"
        },
        "tag_created_by_customer_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tag Created By Customer Id"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "tag_text",
        "organization_id",
        "asset_tag_created_by_customer_id"
      ],
      "title": "AssetTags"
    },
    "DatabaseAssetSlice": {
      "properties": {
        "slicing_recipe_id": {
          "type": "integer",
          "title": "Slicing Recipe Id"
        },
        "slice_boundaries": {
          "prefixItems": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "integer",
              "minimum": 0
            }
          ],
          "type": "array",
          "maxItems": 2,
          "minItems": 2,
          "title": "Slice Boundaries"
        },
        "slice_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Slice Id"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "slicing_recipe_id",
        "slice_boundaries"
      ],
      "title": "DatabaseAssetSlice"
    },
    "DatabaseFrame": {
      "properties": {
        "is_target": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Is Target"
        },
        "frame_asset": {
          "items": {
            "$ref": "#/$defs/DatabaseProblemAsset"
          },
          "type": "array",
          "minItems": 1,
          "title": "Frame Asset",
          "unique_items": true
        },
        "frame_id": {
          "type": "integer",
          "title": "Frame Id"
        },
        "answers": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/AnswerClass"
              },
              "type": "array",
              "maxLength": 20,
              "unique_items": true
            },
            {
              "type": "null"
            }
          ],
          "title": "Answers"
        }
      },
      "type": "object",
      "required": [
        "frame_asset",
        "frame_id"
      ],
      "title": "DatabaseFrame"
    },
    "DatabaseProblemAsset": {
      "properties": {
        "project_id": {
          "type": "integer",
          "title": "Project Id"
        },
        "asset_id": {
          "type": "integer",
          "title": "Asset Id"
        },
        "text_highlight": {
          "anyOf": [
            {
              "items": {
                "prefixItems": [
                  {
                    "type": "integer",
                    "minimum": 0
                  },
                  {
                    "type": "integer",
                    "minimum": 0
                  }
                ],
                "type": "array",
                "maxItems": 2,
                "minItems": 2
              },
              "type": "array",
              "unique_items": true
            },
            {
              "type": "null"
            }
          ],
          "title": "Text Highlight"
        },
        "slice": {
          "anyOf": [
            {
              "$ref": "#/$defs/DatabaseAssetSlice"
            },
            {
              "type": "null"
            }
          ]
        },
        "asset_tags": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/AssetTags"
              },
              "type": "array",
              "minLength": 1,
              "unique_items": true
            },
            {
              "type": "null"
            }
          ],
          "title": "Asset Tags"
        },
        "view_order": {
          "type": "integer",
          "title": "View Order"
        }
      },
      "type": "object",
      "required": [
        "project_id",
        "asset_id",
        "view_order"
      ],
      "title": "DatabaseProblemAsset"
    },
    "DatabaseProblemProperties": {
      "properties": {
        "pre_answer_explainer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Pre Answer Explainer"
        },
        "internal_notes": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Internal Notes"
        },
        "patch": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Patch"
        },
        "problem_explanation": {
          "anyOf": [
            {
              "$ref": "#/$defs/ProblemExplanation"
            },
            {
              "type": "null"
            }
          ]
        },
        "labeling_state": {
          "$ref": "#/$defs/ProblemLabelingState",
          "default": "on_deck"
        }
      },
      "type": "object",
      "title": "DatabaseProblemProperties"
    },
    "ProblemExplanation": {
      "properties": {
        "explanation": {
          "type": "string",
          "title": "Explanation"
        },
        "created_by_customer_id": {
          "type": "integer",
          "title": "Created By Customer Id"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "explanation",
        "created_by_customer_id"
      ],
      "title": "ProblemExplanation"
    },
    "ProblemLabelingState": {
      "type": "string",
      "enum": [
        "canceled",
        "user_flagged",
        "active",
        "qa",
        "silver_standard",
        "unresolved",
        "ignore",
        "ready",
        "done",
        "on_deck",
        "ready_gold_standard",
        "gold_standard"
      ],
      "title": "ProblemLabelingState",
      "description": "The labeling states a problem can be in.\n\ngames.labeling_states also carries a `tutorial` row, which is retired and deliberately\nnot modelled here. The sync test asserts it is the only such state, so a genuinely new\none fails CI rather than going unnoticed."
    },
    "ProblemParent": {
      "properties": {
        "parent_topic_id": {
          "type": "integer",
          "title": "Parent Topic Id"
        },
        "parent_problem_id": {
          "type": "integer",
          "title": "Parent Problem Id"
        },
        "notes": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Notes"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "parent_topic_id",
        "parent_problem_id"
      ],
      "title": "ProblemParent"
    },
    "ProblemTags": {
      "properties": {
        "tag_text": {
          "type": "string",
          "title": "Tag Text"
        },
        "customer_data_tag_id": {
          "type": "integer",
          "title": "Customer Data Tag Id"
        },
        "organization_id": {
          "type": "integer",
          "title": "Organization Id"
        },
        "problem_tag_created_by_customer_id": {
          "type": "integer",
          "title": "Problem Tag Created By Customer Id"
        },
        "tag_created_by_customer_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tag Created By Customer Id"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "tag_text",
        "customer_data_tag_id",
        "organization_id",
        "problem_tag_created_by_customer_id"
      ],
      "title": "ProblemTags"
    }
  }
}