using MessagePack;

namespace ZB.MOM.WW.OtOpcUa.Driver.FOCAS.Shared.Contracts;

/// <summary>
///     Open a FOCAS session against the CNC at <see cref="HostAddress"/>. One session per
///     configured device. The Host owns the Fwlib32 handle; the Proxy tracks only the
///     opaque <see cref="OpenSessionResponse.SessionId"/> returned on success.
/// </summary>
[MessagePackObject]
public sealed class OpenSessionRequest
{
    [Key(0)] public string HostAddress { get; set; } = string.Empty;
    [Key(1)] public int TimeoutMs { get; set; } = 2000;
    [Key(2)] public int CncSeries { get; set; }
}

[MessagePackObject]
public sealed class OpenSessionResponse
{
    [Key(0)] public bool Success { get; set; }
    [Key(1)] public long SessionId { get; set; }
    [Key(2)] public string? Error { get; set; }
    [Key(3)] public string? ErrorCode { get; set; }
}

[MessagePackObject]
public sealed class CloseSessionRequest
{
    [Key(0)] public long SessionId { get; set; }
}
