Files
HC_APTBS/Services/IConfigurationService.cs
LucianoDev c617854c09 feat: implement SavePump/SaveAlarms, fix config round-trip bugs, redesign PDF reports
Config system fixes:
- Implement SavePump() — full XML serialization with insert/update by pump ID
- Add CanBusParameter.ToPumpXml() for legacy P1-P6 pump param format
- Fix LastRotationDirection never loaded in LoadSettings()
- Add SaveAlarms() to ConfigurationService and IConfigurationService
- Remove dead fields AppSettings.Clients and AppSettings.PumpIds

PDF report redesign:
- Professional layout with charts, verdict badges, and tolerance bands
- Add ReportChartRenderer (SVG) and ReportTheme styling constants
- Embed default_logo.png as fallback report logo

Documentation:
- Add gap analysis docs (config validation, ford unlock, missing features)
- Update CLAUDE.md architecture, known gaps, and debt tracking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 15:21:22 +02:00

83 lines
4.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);
// ── Alarms ────────────────────────────────────────────────────────────────
/// <summary>Persists alarm definitions to <c>alarms.xml</c>.</summary>
void SaveAlarms();
// ── Sensors ───────────────────────────────────────────────────────────────
/// <summary>Saves updated sensor calibration data to <c>sensors.xml</c>.</summary>
void SaveSensors();
// ── Users ─────────────────────────────────────────────────────────────────
/// <summary>Validates a username/password pair against stored credentials.</summary>
bool ValidateUser(string username, string password);
/// <summary>Returns all stored user credentials as a dictionary.</summary>
IReadOnlyDictionary<string, string> GetUsers();
/// <summary>Replaces all stored user credentials and persists them.</summary>
void UpdateUsers(Dictionary<string, string> users);
}
}