using System.Text.Json.Serialization;
namespace PersonalToolBox.Models;
///
/// 工具项模型,表示用户添加的一个可执行工具
///
public class ToolItem
{
///
/// 工具唯一标识 (UUID)
///
public string Id { get; set; } = Guid.NewGuid().ToString();
///
/// 工具显示名称
///
public string Name { get; set; } = string.Empty;
///
/// 内置图标库的图标枚举名称(如 "Github", "Wrench"),用于 FontAwesome 图标渲染
///
public string IconCode { get; set; } = string.Empty;
///
/// 可执行文件路径或 URL
///
public string ExecutablePath { get; set; } = string.Empty;
///
/// 运行参数(选填)
///
public string Arguments { get; set; } = string.Empty;
///
/// 所属分类 ID
///
public string CategoryId { get; set; } = string.Empty;
///
/// 全局快捷键(如 Ctrl+Alt+T),选填
///
public string HotKey { get; set; } = string.Empty;
///
/// 路径是否有效(仅运行时计算,不存入 JSON)
///
[JsonIgnore]
public bool IsValid { get; set; } = true;
///
/// 是否为组合卡片(一键多开)
///
public bool IsGroup { get; set; }
///
/// 当 IsGroup 为 true 时,存储需批量启动的子工具 ID 列表
///
public List SubToolIds { get; set; } = new();
///
/// 是否在软件启动时自动运行
///
public bool AutoRunOnStart { get; set; }
///
/// 路径是否指向 .exe 文件(仅运行时判断,不存入 JSON)
///
[JsonIgnore]
public bool IsExePath =>
!IsGroup && !string.IsNullOrWhiteSpace(ExecutablePath) &&
ExecutablePath.EndsWith(".exe", StringComparison.OrdinalIgnoreCase);
}