namespace Flyshot.ControllerClientCompat;

/// <summary>
/// 保存状态页需要的 ControllerClient 兼容层元数据快照，避免状态页连续读取多个受保护字段。
/// </summary>
public sealed record ControllerClientStatusSnapshotMetadata
{
    /// <summary>
    /// 初始化一份兼容层状态元数据快照。
    /// </summary>
    /// <param name="isSetup">当前是否已经完成机器人初始化。</param>
    /// <param name="robotName">当前机器人名称；未初始化时为空。</param>
    /// <param name="degreesOfFreedom">当前机器人自由度；未初始化时为 0。</param>
    /// <param name="uploadedTrajectories">当前已上传轨迹名称快照。</param>
    /// <param name="serverVersion">兼容服务端版本。</param>
    /// <param name="clientVersion">兼容客户端版本。</param>
    public ControllerClientStatusSnapshotMetadata(
        bool isSetup,
        string? robotName,
        int degreesOfFreedom,
        IReadOnlyList<string> uploadedTrajectories,
        string serverVersion,
        string clientVersion)
    {
        IsSetup = isSetup;
        RobotName = robotName;
        DegreesOfFreedom = degreesOfFreedom;
        UploadedTrajectories = uploadedTrajectories.ToArray();
        ServerVersion = serverVersion;
        ClientVersion = clientVersion;
    }

    /// <summary>
    /// 获取当前是否已经完成机器人初始化。
    /// </summary>
    public bool IsSetup { get; }

    /// <summary>
    /// 获取当前机器人名称；未初始化时为空。
    /// </summary>
    public string? RobotName { get; }

    /// <summary>
    /// 获取当前机器人自由度；未初始化时为 0。
    /// </summary>
    public int DegreesOfFreedom { get; }

    /// <summary>
    /// 获取已上传轨迹名称数组快照。
    /// </summary>
    public IReadOnlyList<string> UploadedTrajectories { get; }

    /// <summary>
    /// 获取兼容服务端版本。
    /// </summary>
    public string ServerVersion { get; }

    /// <summary>
    /// 获取兼容客户端版本。
    /// </summary>
    public string ClientVersion { get; }
}
