/*
* 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 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
using System;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using ThreadPilot.Models;
namespace ThreadPilot.Services
{
public interface IPowerPlanService
{
///
/// Event fired when the active power plan changes
///
event EventHandler? PowerPlanChanged;
Task> GetPowerPlansAsync();
Task> GetCustomPowerPlansAsync();
Task SetActivePowerPlan(PowerPlanModel powerPlan);
Task GetActivePowerPlan();
Task ImportCustomPowerPlan(string filePath);
///
/// Sets the active power plan by GUID with duplicate change prevention
///
Task SetActivePowerPlanByGuidAsync(string powerPlanGuid, bool preventDuplicateChanges = true);
///
/// Gets the currently active power plan GUID
///
Task GetActivePowerPlanGuidAsync();
///
/// Checks if a power plan with the given GUID exists
///
Task PowerPlanExistsAsync(string powerPlanGuid);
///
/// Gets a power plan by GUID
///
Task GetPowerPlanByGuidAsync(string powerPlanGuid);
///
/// Validates that a power plan change is necessary
///
Task IsPowerPlanChangeNeededAsync(string targetPowerPlanGuid);
}
///
/// Event arguments for power plan changes
///
public class PowerPlanChangedEventArgs : EventArgs
{
public PowerPlanModel? PreviousPowerPlan { get; }
public PowerPlanModel? NewPowerPlan { get; }
public DateTime Timestamp { get; }
public string? Reason { get; }
public PowerPlanChangedEventArgs(PowerPlanModel? previousPowerPlan, PowerPlanModel? newPowerPlan, string? reason = null)
{
PreviousPowerPlan = previousPowerPlan;
NewPowerPlan = newPowerPlan;
Timestamp = DateTime.Now;
Reason = reason;
}
}
}