using System;
namespace StellaOps.TimelineIndexer.Infrastructure.Options;
///
/// Configuration for timeline ingestion transports (NATS, Redis).
///
public sealed class TimelineIngestionOptions
{
public NatsIngestionOptions Nats { get; init; } = new();
public RedisIngestionOptions Redis { get; init; } = new();
}
public sealed class NatsIngestionOptions
{
///
/// Enables NATS subscription when true.
///
public bool Enabled { get; init; }
///
/// NATS server URL (e.g., nats://localhost:4222).
///
public string Url { get; init; } = "nats://localhost:4222";
///
/// Subject to subscribe to for orchestrator events.
///
public string Subject { get; init; } = "orch.event";
///
/// Queue group for shared subscriptions to preserve ordering per subject.
///
public string QueueGroup { get; init; } = "timeline-indexer";
///
/// Maximum in-flight messages per subscriber.
///
public int Prefetch { get; init; } = 64;
}
public sealed class RedisIngestionOptions
{
///
/// Enables Redis Stream subscription when true.
///
public bool Enabled { get; init; }
///
/// Redis connection string (e.g., localhost:6379 or rediss://...).
///
public string ConnectionString { get; init; } = "localhost:6379";
///
/// Stream name carrying timeline events.
///
public string Stream { get; init; } = "timeline.events";
///
/// Consumer group used for ordered consumption.
///
public string ConsumerGroup { get; init; } = "timeline-indexer";
///
/// Consumer name used when reading from the group.
///
public string ConsumerName { get; init; } = Environment.MachineName ?? "timeline-indexer";
///
/// Field that contains the JSON payload within the stream entry.
///
public string ValueField { get; init; } = "data";
///
/// Maximum entries fetched per polling iteration.
///
public int MaxBatchSize { get; init; } = 128;
///
/// Polling interval in milliseconds when no entries are available.
///
public int PollIntervalMilliseconds { get; init; } = 250;
}