{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/myarchivist-ai/json-schema/myarchivist-ai-quest-read-schema.json",
  "title": "QuestRead",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/myarchivist-ai-openapi.json#/components/schemas/QuestRead",
  "properties": {
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "updated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Updated At"
    },
    "id": {
      "type": "string",
      "title": "Id"
    },
    "campaign_id": {
      "type": "string",
      "title": "Campaign Id"
    },
    "order_index": {
      "type": "integer",
      "title": "Order Index"
    },
    "quest_name": {
      "type": "string",
      "title": "Quest Name"
    },
    "quest_giver": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Quest Giver"
    },
    "quest_giver_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Quest Giver Id"
    },
    "quest_category": {
      "$ref": "#/$defs/QuestCategoryValue"
    },
    "status": {
      "$ref": "#/$defs/QuestStatusValue"
    },
    "success_definition": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Success Definition"
    },
    "failure_conditions": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Failure Conditions"
    },
    "next_action": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Action"
    },
    "resolution": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Resolution"
    },
    "objectives": {
      "items": {
        "$ref": "#/$defs/QuestObjectiveRead"
      },
      "type": "array",
      "title": "Objectives"
    },
    "objective_count": {
      "type": "integer",
      "title": "Objective Count",
      "default": 0
    },
    "completed_objective_count": {
      "type": "integer",
      "title": "Completed Objective Count",
      "default": 0
    },
    "progress_entry_count": {
      "type": "integer",
      "title": "Progress Entry Count",
      "default": 0
    },
    "progress_log": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Progress Log"
    },
    "progress_log_entries": {
      "items": {
        "$ref": "#/$defs/QuestProgressEntryRead"
      },
      "type": "array",
      "title": "Progress Log Entries"
    },
    "related_characters": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Related Characters"
    },
    "related_factions": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Related Factions"
    },
    "related_locations": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Related Locations"
    },
    "related_items": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Related Items"
    },
    "related_entity_refs": {
      "items": {
        "$ref": "#/$defs/QuestRelatedEntityRefRead"
      },
      "type": "array",
      "title": "Related Entity Refs"
    },
    "first_session": {
      "anyOf": [
        {
          "$ref": "#/$defs/QuestSessionRef"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_session": {
      "anyOf": [
        {
          "$ref": "#/$defs/QuestSessionRef"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "created_at",
    "id",
    "campaign_id",
    "order_index",
    "quest_name",
    "quest_category",
    "status"
  ],
  "$defs": {
    "ObjectiveStatusValue": {
      "type": "string",
      "enum": [
        "pending",
        "in-progress",
        "completed",
        "failed",
        "blocked"
      ],
      "title": "ObjectiveStatusValue"
    },
    "QuestCategoryValue": {
      "type": "string",
      "enum": [
        "main",
        "side",
        "faction",
        "personal",
        "n/a"
      ],
      "title": "QuestCategoryValue"
    },
    "QuestEntityTypeValue": {
      "type": "string",
      "enum": [
        "character",
        "faction",
        "location",
        "item"
      ],
      "title": "QuestEntityTypeValue"
    },
    "QuestObjectiveRead": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "text": {
          "type": "string",
          "maxLength": 1000,
          "minLength": 1,
          "title": "Text"
        },
        "status": {
          "$ref": "#/$defs/ObjectiveStatusValue",
          "default": "pending"
        },
        "order": {
          "type": "integer",
          "title": "Order"
        }
      },
      "type": "object",
      "required": [
        "id",
        "text",
        "order"
      ],
      "title": "QuestObjectiveRead"
    },
    "QuestProgressEntryRead": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "text": {
          "type": "string",
          "title": "Text"
        },
        "order": {
          "type": "integer",
          "title": "Order"
        },
        "session_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Session Id"
        },
        "session_number": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Session Number"
        },
        "session_title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Session Title"
        },
        "session_date": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Session Date"
        }
      },
      "type": "object",
      "required": [
        "id",
        "text",
        "order"
      ],
      "title": "QuestProgressEntryRead"
    },
    "QuestRelatedEntityRefRead": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "entity_type": {
          "$ref": "#/$defs/QuestEntityTypeValue"
        },
        "entity_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Entity Id"
        },
        "entity_name_snapshot": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 255
            },
            {
              "type": "null"
            }
          ],
          "title": "Entity Name Snapshot"
        },
        "label": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 255
            },
            {
              "type": "null"
            }
          ],
          "title": "Label"
        },
        "order": {
          "type": "integer",
          "title": "Order"
        }
      },
      "type": "object",
      "required": [
        "id",
        "entity_type",
        "order"
      ],
      "title": "QuestRelatedEntityRefRead"
    },
    "QuestSessionRef": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "number": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Number"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Title"
        },
        "session_date": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Session Date"
        }
      },
      "type": "object",
      "required": [
        "id"
      ],
      "title": "QuestSessionRef"
    },
    "QuestStatusValue": {
      "type": "string",
      "enum": [
        "planned",
        "in-progress",
        "blocked",
        "failed",
        "done",
        "n/a"
      ],
      "title": "QuestStatusValue"
    }
  }
}