namespace Theriapolis.Core.Rules.Reputation;
///
/// Phase 6 M2 — typed, append-only log entry recording a single reputation
/// change. Events are the *cause*; the resulting standing/disposition
/// update is the *effect*. We keep the cause around so the UI can answer
/// "why does so-and-so hate me?" with breadcrumbs.
///
/// Phase 6 M5 layers propagation on top: events written here can fan out
/// to other settlements with distance/time decay.
///
public enum RepEventKind : byte
{
Dialogue = 0,
Quest = 1,
Combat = 2,
Rescue = 3,
Betrayal = 4,
Gift = 5,
Trade = 6,
Scent = 7,
Death = 8, // killing a faction-affiliated NPC
Aid = 9, // healing / curing / saving a non-combatant
Crime = 10,
///
/// Phase 6.5 M5 — an NPC's scent-detection roll exposed the player
/// as a hybrid. Per-NPC personal-only event (no faction propagation
/// in M5; Phase 8's scent simulation can extend this).
///
HybridDetected = 11,
Misc = 255,
}
/// One immutable reputation event. Time-stamped and tagged with
/// origin coordinates so propagation can apply distance/time decay.
public sealed record RepEvent
{
///
/// Phase 6 M5 — monotonically increasing id assigned by
/// . Used as the deterministic-RNG
/// seed for frontier-settlement delivery coin-flips. 0 means "not
/// yet appended to a ledger".
///
public int SequenceId { get; init; } = 0;
public RepEventKind Kind { get; init; } = RepEventKind.Misc;
/// Faction id this event affects (empty = personal-only event).
public string FactionId { get; init; } = "";
/// NPC role tag this event affects personally (empty = world-only event).
public string RoleTag { get; init; } = "";
/// Magnitude before opposition matrix / decay. Sign indicates direction.
public int Magnitude { get; init; }
/// Free-form origin context: "saved-her-kit-from-drowning" / "killed-thornfield-guard".
public string Note { get; init; } = "";
/// World-tile coordinates where the event occurred (for M5 propagation).
public int OriginTileX { get; init; }
public int OriginTileY { get; init; }
/// WorldClock seconds at the time the event was logged.
public long TimestampSeconds { get; init; }
}