using MBN_STOCK_WEBVIEW.Core.Playout;
using MBN_STOCK_WEBVIEW.Core.Playout.Scenes;

namespace MBN_STOCK_WEBVIEW.Core.Tests;

public sealed class LegacyScenePreviewTests
{
    [Fact]
    public void Preview_DescribesTypedValuesAndNeverExposesAssetPaths()
    {
        const string secretAsset = @"Video\operator-private-background.vrv";
        var preview = LegacyScenePreviewFactory.Create(
        [
            new PlayoutSetValue("title", "삼성전자"),
            new PlayoutSetAssetValue("logo", @"Image\005930.png"),
            new PlayoutSetVisible("up", true),
            new PlayoutSetFaceColor("cube", 1, 2, 3, 4),
            new PlayoutSetPosition("bar", 1, 2, 3, PlayoutVectorComponents.XYZ),
            new PlayoutSetPositionKey("bar", 2, 4, 5, 6, PlayoutVectorComponents.XY),
            new PlayoutSetScale("bar", 7, 8, 9, PlayoutVectorComponents.XYZ),
            new PlayoutSetCropKey("candle", 1, 2, 3, 4, 5, PlayoutCropEdges.All),
            new PlayoutSetCircleAngleKey("pie", 3, 10, 20, PlayoutAngleComponents.All),
            new PlayoutSetPathPoints("line", [new(1, 2), new(3, 4, 5)]),
            new PlayoutSetPathShapePoints("shape", [new(6, 7)]),
            new PlayoutSetBackgroundTexture(secretAsset),
            new PlayoutSetBackgroundVideo(secretAsset, 2004, 10),
            new PlayoutUseBackground(true)
        ]);

        Assert.Collection(
            preview,
            value => Assert.Equal(new("value", "title", "삼성전자"), value),
            value => Assert.Equal(new("asset", "logo", "configured"), value),
            value => Assert.Equal(new("visible", "up", "true"), value),
            value => Assert.Equal(new("color", "cube", "1,2,3,4"), value),
            value => Assert.Equal(new("position", "bar", "1,2,3 [XYZ]"), value),
            value => Assert.Equal(new("position-key", "bar", "key=2;4,5,6 [XY]"), value),
            value => Assert.Equal(new("scale", "bar", "7,8,9 [XYZ]"), value),
            value => Assert.Equal(new("crop", "candle", "key=1;2,3,4,5 [All]"), value),
            value => Assert.Equal(new("angle", "pie", "key=3;10,20 [All]"), value),
            value => Assert.Equal(new("path", "line", "count=2;1,2,0;3,4,5"), value),
            value => Assert.Equal(new("path-shape", "shape", "count=1;6,7,0"), value),
            value => Assert.Equal(new("background-texture", "scene", "configured"), value),
            value => Assert.Equal(
                new("background-video", "scene", "configured;loop=2004;loop-mode=10"),
                value),
            value => Assert.Equal(new("background", "scene", "enabled"), value));
        Assert.DoesNotContain(secretAsset, string.Join("|", preview.Select(value => value.Value)));
        Assert.DoesNotContain("005930.png", string.Join("|", preview.Select(value => value.Value)));
    }
}
