using System.Text.Json;
using FluentAssertions;
using VigilCare.ClinicalContracts.Sync;

public class ClinicalContractsTests
{
    [Fact]
    public void ClinicalSyncBatchRequest_RoundTripsJson()
    {
        var original = new ClinicalSyncBatchRequest(
            BatchReference: Guid.NewGuid(),
            GatewayId: Guid.NewGuid(),
            SiteId: Guid.NewGuid(),
            CapturedAtUtc: DateTimeOffset.UtcNow,
            Observations: [
                new SyncedObservation(
                    Guid.NewGuid(), "key-001", Guid.NewGuid(),
                    "HEART_RATE", 118m, "bpm", "bedside_monitor",
                    DateTimeOffset.UtcNow)
            ],
            AlertEvents: [],
            AlertAcknowledgments: [],
            AlertResolutions: []);

        var json = JsonSerializer.Serialize(original);
        var restored = JsonSerializer.Deserialize<ClinicalSyncBatchRequest>(json);

        restored.Should().BeEquivalentTo(original);
    }
}