/* * ThreadPilot - Advanced Windows Process and Power Plan Manager * Copyright (C) 2025 Prime Build * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, version 3 only. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ namespace ThreadPilot.Services { using System; using System.Collections.Generic; using System.Threading.Tasks; using ThreadPilot.Models; /// /// Interface for managing process-power plan associations. /// public interface IProcessPowerPlanAssociationService { /// /// Event fired when configuration changes /// event EventHandler? ConfigurationChanged; /// /// Gets the current configuration. /// ProcessMonitorConfiguration Configuration { get; } /// /// Loads configuration from persistent storage. /// Task LoadConfigurationAsync(); /// /// Saves configuration to persistent storage. /// Task SaveConfigurationAsync(); /// /// Gets all associations. /// Task> GetAssociationsAsync(); /// /// Gets enabled associations only. /// Task> GetEnabledAssociationsAsync(); /// /// Adds a new association. /// Task AddAssociationAsync(ProcessPowerPlanAssociation association); /// /// Updates an existing association. /// Task UpdateAssociationAsync(ProcessPowerPlanAssociation association); /// /// Removes an association. /// Task RemoveAssociationAsync(string associationId); /// /// Finds the best matching association for a process. /// Task FindMatchingAssociationAsync(ProcessModel process); /// /// Finds association by executable name. /// Task FindAssociationByExecutableAsync(string executableName); /// /// Sets the default power plan. /// Task SetDefaultPowerPlanAsync(string powerPlanGuid, string powerPlanName); /// /// Gets the default power plan. /// Task<(string Guid, string Name)> GetDefaultPowerPlanAsync(); /// /// Validates the current configuration. /// Task> ValidateConfigurationAsync(); /// /// Resets configuration to defaults. /// Task ResetConfigurationAsync(); /// /// Exports configuration to a file. /// Task ExportConfigurationAsync(string filePath); /// /// Imports configuration from a file. /// Task ImportConfigurationAsync(string filePath); /// /// Replaces the current configuration and persists it. /// Task ReplaceConfigurationAsync(ProcessMonitorConfiguration configuration); } /// /// Event arguments for configuration changes. /// public class ConfigurationChangedEventArgs : EventArgs { public string ChangeType { get; } public ProcessPowerPlanAssociation? Association { get; } public string? Details { get; } public ConfigurationChangedEventArgs(string changeType, ProcessPowerPlanAssociation? association = null, string? details = null) { this.ChangeType = changeType; this.Association = association; this.Details = details; } } }