using System.IO;
using System.Net.NetworkInformation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using skyscraper5.Skyscraper.IO;

namespace skyscraper8.Tests.ResourceTests;

[TestClass]
public class NtbuDoability
{
    [TestMethod]
    public void DecodeUnifiInform()
    {
        byte[] bytes = Resources1.ubnt;
        MemoryStream stream = new MemoryStream(bytes,false);
        if (stream.ReadUInt32BE() != 1414414933u)
            Assert.Fail();
        
        if (stream.ReadUInt32BE() != 0)
            Assert.Fail();

        PhysicalAddress apMac = new PhysicalAddress(stream.ReadBytes(6));
        ushort flags = stream.ReadUInt16BE();
        
        bool encrypted = (flags & 0x0001) != 0;
        bool zlib = (flags & 0x0002) != 0;
        bool snappy = (flags & 0x0004) != 0;
        bool aesGcm = (flags & 0x0008) != 0;

        byte[] iv = stream.ReadBytes(16);
        
        uint dataVersion = stream.ReadUInt32BE();
        uint payloadLength = stream.ReadUInt32BE();
        byte[] payload = stream.ReadBytes(payloadLength);
    }
}
