Files
HC_APTBS/Services/IConfigurationService.cs
2026-04-11 12:45:18 +02:00

67 lines
3.2 KiB
C#

using System.Collections.Generic;
using HC_APTBS.Models;
namespace HC_APTBS.Services
{
/// <summary>
/// Provides read/write access to persisted application configuration.
/// Configuration files live under <c>%UserProfile%\.HC_APTBS\config\</c>.
/// </summary>
public interface IConfigurationService
{
// ── Settings ──────────────────────────────────────────────────────────────
/// <summary>Application-wide settings (temperature limits, PID, refresh rates, etc.).</summary>
AppSettings Settings { get; }
/// <summary>Persists <see cref="Settings"/> to <c>config.xml</c>.</summary>
void SaveSettings();
// ── Bench configuration ───────────────────────────────────────────────────
/// <summary>
/// Current bench CAN parameter map and relay definitions.
/// Loaded from <c>bench.xml</c> on first access.
/// </summary>
BenchConfiguration Bench { get; }
/// <summary>Persists <see cref="Bench"/> to <c>bench.xml</c>.</summary>
void SaveBench();
// ── Pump database ─────────────────────────────────────────────────────────
/// <summary>Returns all known pump IDs from the pump database.</summary>
IReadOnlyList<string> GetPumpIds();
/// <summary>
/// Loads the full <see cref="PumpDefinition"/> for the pump with the given ID,
/// including its CAN parameter map and test list.
/// </summary>
PumpDefinition? LoadPump(string pumpId);
/// <summary>Persists a pump definition back to the database.</summary>
void SavePump(PumpDefinition pump);
// ── Clients ───────────────────────────────────────────────────────────────
/// <summary>Sorted client name → contact info dictionary.</summary>
SortedDictionary<string, string> Clients { get; }
/// <summary>Persists the client list to <c>clients.xml</c>.</summary>
void SaveClients();
// ── Pump status definitions ───────────────────────────────────────────────
/// <summary>
/// Loads the <see cref="PumpStatusDefinition"/> for the given status ID.
/// Definitions are cached after first load. Returns null if the ID is not found.
/// </summary>
PumpStatusDefinition? LoadPumpStatus(int statusId);
// ── Sensors ───────────────────────────────────────────────────────────────
/// <summary>Saves updated sensor calibration data to <c>sensors.xml</c>.</summary>
void SaveSensors();
}
}