using System; using System.Collections.Generic; using System.Threading.Tasks; using ThreadPilot.Models; namespace ThreadPilot.Services { /// /// Event arguments for profile application events /// public class ProfileApplicationEventArgs : EventArgs { public ConditionalProcessProfile Profile { get; set; } = new(); public ProcessModel Process { get; set; } = new(); public SystemState SystemState { get; set; } = new(); public bool WasApplied { get; set; } public string Reason { get; set; } = string.Empty; public DateTime Timestamp { get; set; } = DateTime.UtcNow; } /// /// Event arguments for profile conflict events /// public class ProfileConflictEventArgs : EventArgs { public List ConflictingProfiles { get; set; } = new(); public ProcessModel Process { get; set; } = new(); public ConditionalProcessProfile SelectedProfile { get; set; } = new(); public string Resolution { get; set; } = string.Empty; } /// /// Service for managing conditional process profiles /// public interface IConditionalProfileService { /// /// Initialize the conditional profile service /// Task InitializeAsync(); /// /// Add a conditional profile /// Task AddProfileAsync(ConditionalProcessProfile profile); /// /// Remove a conditional profile /// Task RemoveProfileAsync(string profileId); /// /// Update an existing conditional profile /// Task UpdateProfileAsync(ConditionalProcessProfile profile); /// /// Get all conditional profiles /// Task> GetAllProfilesAsync(); /// /// Get profiles for a specific process /// Task> GetProfilesForProcessAsync(string processName); /// /// Evaluate all profiles for a process and return applicable ones /// Task> EvaluateProfilesAsync(ProcessModel process); /// /// Apply the best matching profile for a process /// Task ApplyBestProfileAsync(ProcessModel process); /// /// Get current system state for condition evaluation /// Task GetSystemStateAsync(); /// /// Start automatic profile monitoring and application /// Task StartMonitoringAsync(); /// /// Stop automatic profile monitoring /// Task StopMonitoringAsync(); /// /// Check if monitoring is active /// bool IsMonitoring { get; } /// /// Resolve conflicts when multiple profiles match /// ConditionalProcessProfile ResolveProfileConflict(List conflictingProfiles, ProcessModel process); /// /// Create a default conditional profile template /// ConditionalProcessProfile CreateDefaultProfile(string processName); /// /// Validate a conditional profile /// Task<(bool IsValid, List Errors)> ValidateProfileAsync(ConditionalProcessProfile profile); /// /// Export profiles to JSON /// Task ExportProfilesToJsonAsync(); /// /// Import profiles from JSON /// Task ImportProfilesFromJsonAsync(string json); /// /// Event raised when a profile is automatically applied /// event EventHandler? ProfileApplied; /// /// Event raised when profile conflicts are resolved /// event EventHandler? ProfileConflictResolved; /// /// Event raised when system state changes significantly /// event EventHandler? SystemStateChanged; } }