using System.ComponentModel.DataAnnotations; namespace MarketAlly.AIPlugin.Context.Configuration { /// /// Configuration settings for the context management system /// public class ContextConfiguration { /// /// Storage path for context files /// [Required] public string StoragePath { get; set; } = ".context"; /// /// Maximum context size in characters /// [Range(1000, 1000000)] public int MaxContextSize { get; set; } = 50000; /// /// Enable compression for older files /// public bool EnableCompression { get; set; } = true; /// /// Retention policy settings /// public RetentionPolicy Retention { get; set; } = new(); /// /// Search configuration settings /// public SearchConfiguration Search { get; set; } = new(); /// /// Performance configuration settings /// public PerformanceConfiguration Performance { get; set; } = new(); /// /// Security configuration settings /// public SecurityConfiguration Security { get; set; } = new(); /// /// Monitoring and observability settings /// public MonitoringConfiguration Monitoring { get; set; } = new(); } /// /// Retention policy configuration /// public class RetentionPolicy { /// /// Maximum number of entries per file /// [Range(100, 10000)] public int MaxEntriesPerFile { get; set; } = 1000; /// /// Retention period in days /// [Range(1, 3650)] public int RetentionDays { get; set; } = 90; /// /// Maximum file size in bytes /// [Range(1024, 100 * 1024 * 1024)] public long MaxFileSizeBytes { get; set; } = 10 * 1024 * 1024; // 10MB /// /// Age in days after which files should be compressed /// [Range(1, 365)] public int CompressionAgeInDays { get; set; } = 30; /// /// Enable automatic cleanup of expired entries /// public bool EnableAutoCleanup { get; set; } = true; } /// /// Search configuration settings /// public class SearchConfiguration { /// /// Enable semantic search capabilities /// public bool EnableSemanticSearch { get; set; } = false; /// /// Enable fuzzy matching for searches /// public bool EnableFuzzyMatching { get; set; } = true; /// /// Fuzzy matching threshold (0.0 to 1.0) /// [Range(0.0, 1.0)] public double FuzzyMatchingThreshold { get; set; } = 0.7; /// /// Maximum number of search results to return /// [Range(1, 1000)] public int MaxSearchResults { get; set; } = 50; /// /// Enable search result caching /// public bool EnableCaching { get; set; } = true; /// /// Cache expiration time in minutes /// [Range(1, 1440)] public int CacheExpirationMinutes { get; set; } = 30; /// /// OpenAI API key for semantic search (if enabled) /// public string? OpenAIApiKey { get; set; } /// /// OpenAI model to use for embeddings /// public string OpenAIEmbeddingModel { get; set; } = "text-embedding-3-small"; } /// /// Performance configuration settings /// public class PerformanceConfiguration { /// /// Enable streaming JSON processing for large files /// public bool EnableStreamingJson { get; set; } = true; /// /// Maximum number of entries to process concurrently /// [Range(1, 100)] public int MaxConcurrentOperations { get; set; } = 10; /// /// Cache size limit for search results /// [Range(100, 10000)] public int CacheSizeLimit { get; set; } = 1000; /// /// Cache compaction percentage when limit is reached /// [Range(0.1, 0.9)] public double CacheCompactionPercentage { get; set; } = 0.25; /// /// Enable parallel processing for search operations /// public bool EnableParallelProcessing { get; set; } = true; } /// /// Security configuration settings /// public class SecurityConfiguration { /// /// Enable encryption for sensitive content /// public bool EnableEncryption { get; set; } = true; /// /// Encryption key for data protection /// public string? EncryptionKey { get; set; } /// /// Enable sensitive data detection /// public bool EnableSensitiveDataDetection { get; set; } = true; /// /// Automatically encrypt detected sensitive data /// public bool AutoEncryptSensitiveData { get; set; } = true; /// /// Regular expressions for detecting sensitive data patterns /// public List SensitiveDataPatterns { get; set; } = new() { @"\b[A-Za-z0-9+/]{40,}\b", // API keys @"\b[\w\.-]+@[\w\.-]+\.\w+\b", // Email addresses @"\b\d{3}-\d{2}-\d{4}\b", // SSN patterns @"\b(?:\d{4}[-\s]?){3}\d{4}\b", // Credit card numbers @"\bbearer\s+[A-Za-z0-9\-\._~\+\/]+=*\b", // Bearer tokens @"\bpassword[:=]\s*[^\s]+\b" // Password patterns }; } /// /// Monitoring and observability configuration /// public class MonitoringConfiguration { /// /// Enable detailed logging /// public bool EnableDetailedLogging { get; set; } = true; /// /// Enable performance metrics collection /// public bool EnableMetrics { get; set; } = true; /// /// Enable distributed tracing /// public bool EnableTracing { get; set; } = false; /// /// Log level for context operations /// public string LogLevel { get; set; } = "Information"; /// /// Enable health checks for context storage /// public bool EnableHealthChecks { get; set; } = true; /// /// Health check interval in seconds /// [Range(10, 3600)] public int HealthCheckIntervalSeconds { get; set; } = 60; } }