using System;
using System.Collections.Generic;
using Cthangover.Core.Events;
namespace Cthangover.Core.Quests
{
///
/// Serialisable payload that holds the mutable, per‑save‑file runtime
/// state of a single quest. Separating this from the immutable
/// allows the save system to persist only
/// the dirty data (current status and earned tags) without duplicating
/// the static definition fields that are reloaded from mod JSON every
/// session. An instance of this class lives inside
/// and is replaced wholesale by
/// when the player loads a game.
///
[Serializable]
public class QuestData
{
///
/// Numeric representation of the current quest stage, castable to
/// . The journal UI maps this to a
/// description string via .
///
public int Status { get; set; }
///
/// Set of string tags earned during this playthrough. Each tag
/// represents a branching milestone or sub‑objective; scenario
/// scripts query membership via to
/// gate dialogue options and scene transitions.
///
public HashSet Tags { get; set; } = new();
///
/// Sets the numeric status to , advancing
/// (or potentially resetting) the quest's progression stage. Called
/// by scenario action nodes that handle quest advancement commands.
/// Publishes a only when the
/// value actually changed, so cached condition results invalidate on
/// real change rather than on every redundant assignment.
///
public void SetStatus(int value)
{
if (Status == value)
return;
ModEventBus.Publish(new QuestDataStatusChangedEvent { Old = Status, New = value });
Status = value;
}
}
}