using RioJoy.Core.Calibration;
using RioJoy.Core.Mapping;
namespace RioJoy.Core.Profiles;
///
/// A per-game profile: everything about how the cockpit behaves for one
/// non-native game (see docs/PLAN.md §Profiles). The unified profile supersedes
/// the legacy single-file RIO.ini. Profiles never describe the native
/// games — those are the hands-off/yield case.
///
public sealed class RioProfile
{
/// Display name (unique within a library).
public string Name { get; set; } = "Unnamed";
/// RIO serial port (e.g. "COM3"); null = use the app default.
public string? RioComPort { get; set; }
/// Plasma/VFD serial port; null = use the app default or none.
public string? PlasmaComPort { get; set; }
///
/// The iRIO map: RIO address (0x00..0x6F) → 16-bit map word. Only
/// mapped addresses need entries.
///
public Dictionary Buttons { get; set; } = new();
/// Axis calibration / invert options.
public AxisCalibrationConfig Calibration { get; set; } = new();
/// Plasma greeting text shown on load (null = leave display as-is).
public string? PlasmaGreeting { get; set; }
/// Cockpit wallpaper image path (generated in Phase 7).
public string? WallpaperPath { get; set; }
///
/// Overlay label text per template region (region/layer name → display text,
/// e.g. "b-00" → "FIRE"). Drives the Phase 7 wallpaper generator
/// (); empty/absent entries render
/// nothing. The region geometry itself lives in the shared overlay template.
///
public Dictionary OverlayLabels { get; set; } = new();
///
/// Executable names that select this profile when they are the foreground app
/// (matched case-insensitively, with or without ".exe").
///
public List MatchExecutables { get; set; } = new();
/// Build a from .
public RioInputMap ToInputMap()
{
var map = new RioInputMap();
foreach ((int address, int raw) in Buttons)
map[address] = new RioMapEntry((ushort)raw);
return map;
}
}