use std::time::Duration;

// ── AgentPolicy ──────────────────────────────────────────────────────────────

/// Policy controlling what an agent session is allowed to do.
///
/// Declared in the schema at build time via `SchemaBuilder::session_policy`.
/// Policies are validated at schema build time: all signal names must exist
/// in the schema, and no signal may appear in both allow and deny lists.
///
/// # Examples
///
/// ```
/// use std::time::Duration;
/// use tidaldb::schema::AgentPolicy;
///
/// let policy = AgentPolicy {
///     allowed_signals: vec!["reward".to_string(), "preference_hint".to_string()],
///     denied_signals: vec![],
///     max_session_duration: Duration::from_secs(3600),
///     max_signals_per_session: 10_000,
/// };
/// ```
#[derive(Debug, Clone)]
pub struct AgentPolicy {
    /// If non-empty, only these signal types may be written in sessions using this policy.
    pub allowed_signals: Vec<String>,
    /// Signal types always blocked, regardless of `allowed_signals`.
    pub denied_signals: Vec<String>,
    /// Maximum wall-clock duration for a session before it is considered expired.
    pub max_session_duration: Duration,
    /// Maximum total signals that may be written in a single session.
    /// `0` means unlimited.
    pub max_signals_per_session: u32,
}

/// Internal builder entry for a session policy.
#[derive(Debug)]
pub(super) struct PolicyEntry {
    pub(super) name: String,
    pub(super) policy: AgentPolicy,
}
