//! Epoch data structures for time-travel queries.

use rkyv::{Archive, Deserialize, Serialize};

use super::{EpochId, SupersessionType};

/// Represents a distinct period of truth or a specific worldview.
#[derive(Archive, Deserialize, Serialize, Debug, Clone, PartialEq)]
#[archive(check_bytes)]
pub struct Epoch {
    /// The unique ID of this epoch.
    pub id: EpochId,
    /// Human-readable name (e.g., "Pre-2024", "Newtonian").
    pub name: String,
    /// If this epoch replaces another, which one?
    pub supersedes: Option<EpochId>,
    /// How does it supersede the previous one?
    pub supersession_type: Option<SupersessionType>,
    /// The timestamp when this epoch began.
    pub start_timestamp: u64,
    /// The timestamp when this epoch ended (if applicable).
    pub end_timestamp: Option<u64>,
}
