@inject IImmortalSelectionService FilterService
@implements IDisposable

<FormLayoutComponent>
    <div style="@GetBorderStyle()">
        @ChildContent
    </div>
</FormLayoutComponent>

@code {

    [Parameter] public RenderFragment? ChildContent { get; set; }

    protected override void OnInitialized()
    {
        base.OnInitialized();
        FilterService.Subscribe(StateHasChanged);
    }

    void IDisposable.Dispose()
    {
        FilterService.Unsubscribe(StateHasChanged);
    }

    string GetBorderStyle()
    {
        var immortal = FilterService.GetImmortal();
        var color = "#666666";
        if (immortal == DataType.IMMORTAL_Orzum) color = "var(--immortal-orzum)";
        else if (immortal == DataType.IMMORTAL_Ajari) color = "var(--immortal-ajari)";
        else if (immortal == DataType.IMMORTAL_Atzlan) color = "var(--immortal-atzlan)";
        else if (immortal == DataType.IMMORTAL_Mala) color = "var(--immortal-mala)";
        else if (immortal == DataType.IMMORTAL_Xol) color = "var(--immortal-xol)";
        return $"border-top: 4px solid {color}; padding-top: 14px; margin-top: -12px;";
    }

}
