@using DiffPlex
@using DiffPlex.DiffBuilder
@using DiffPlex.DiffBuilder.Model

<div class="diff-view">
    @if (lines is not null)
    {
        @foreach (var line in lines.Lines)
        {
            <div class="diff-line diff-@line.Type.ToString().ToLowerInvariant()">
                <span class="diff-line-num">@line.Position</span>
                <span class="diff-line-text">@line.Text</span>
            </div>
        }
    }
</div>

@code {
    [Parameter]
    public string Original { get; set; } = string.Empty;

    [Parameter]
    public string Corrected { get; set; } = string.Empty;

    private DiffPaneModel? lines;

    protected override void OnParametersSet()
    {
        lines = InlineDiffBuilder.Diff(Original, Corrected);
    }
}
