using ZB.MOM.WW.MxGateway.Contracts;

namespace ZB.MOM.WW.MxGateway.Tests.Contracts;

public sealed class GatewayContractInfoTests
{
    /// <summary>Verifies that the default backend name is "mxaccess-worker".</summary>
    [Fact]
    public void DefaultBackendName_IsMxAccessWorker()
    {
        Assert.Equal("mxaccess-worker", GatewayContractInfo.DefaultBackendName);
    }

    /// <summary>
    ///     Pins the current <see cref="GatewayContractInfo.GatewayProtocolVersion"/>
    ///     constant at 3. All three of the following extensions shipped under
    ///     version 3 as strictly additive contract changes that did not require a
    ///     further bump: (1) the alarm proto extension (<c>AcknowledgeAlarm</c> /
    ///     <c>QueryActiveAlarms</c> RPCs, the <c>OnAlarmTransitionEvent</c> body,
    ///     and the alarm command/reply payload cases); (2) the bulk write/read
    ///     command family (<c>WriteBulk</c> / <c>Write2Bulk</c> /
    ///     <c>WriteSecuredBulk</c> / <c>WriteSecured2Bulk</c> / <c>ReadBulk</c>
    ///     plus their <c>BulkWriteReply</c> and <c>BulkReadReply</c> payloads);
    ///     (3) the sparse-array write ergonomics extension (<c>MxSparseArray</c> /
    ///     <c>MxSparseElement</c> messages plus the <c>sparse_array_value = 19</c>
    ///     arm on the <c>MxValue</c> oneof). A future breaking contract change
    ///     should bump this constant and update this test in lock-step.
    /// </summary>
    [Fact]
    public void GatewayProtocolVersion_IsVersionThree()
    {
        Assert.Equal(3u, GatewayContractInfo.GatewayProtocolVersion);
    }

    /// <summary>Verifies that the worker protocol version starts at version one.</summary>
    [Fact]
    public void WorkerProtocolVersion_StartsAtVersionOne()
    {
        Assert.Equal(1u, GatewayContractInfo.WorkerProtocolVersion);
    }
}
