using Baya.Application.Common;
using Baya.Application.Models.Catalog;

namespace Baya.Test.Foundation.Catalog;

public class VariantSnapshotSerializerTests
{
    [Fact]
    public void Serialize_CarriesCategoryAndOptionLabels_PriceAsString_UnitAndSession()
    {
        var serializer = new VariantSnapshotSerializer();

        var snapshot = new VariantSnapshot(
            VariantId: 12,
            ServiceCategoryId: 1,
            CategoryNameFa: "مراقبت از سالمند",
            CategoryNameEn: "Elderly Care",
            Price: 8000000,
            PriceUnit: "per_24h",
            SessionCount: 3,
            DisplayName: "مراقبت از سالمند · شبانه‌روزی",
            Options: [new VariantOptionDto(10, "نوع شیفت", "Shift type", 100, "شبانه‌روزی", "Live-in")]);

        var json = serializer.Serialize(snapshot);

        // Money is a string of IRR-Rial digits (no floats, no numeric literal).
        Assert.Contains("\"price\":\"8000000\"", json);
        Assert.Contains("\"priceUnit\":\"per_24h\"", json);
        Assert.Contains("\"sessionCount\":3", json);
        Assert.Contains("\"variantId\":12", json);
        // Category labels (both) — Persian lands as readable text, not \uXXXX.
        Assert.Contains("مراقبت از سالمند", json);
        Assert.Contains("Elderly Care", json);
        // Each option label (group + value).
        Assert.Contains("نوع شیفت", json);
        Assert.Contains("شبانه‌روزی", json);
        Assert.Contains("Live-in", json);
    }
}
