@using RBLFeederCommon.Enums
@using RBLNews.Shared.Models

<div class="swb-container">
	<Switch Class="mt-2" Value="this._filter" Label="@this.Text" ValueExpression="() => this._filter" ValueChanged="SwitchChanged"/>
	<span class="swb-badge">@(this.Count)</span>
</div>


@code {

	private bool _filter = true;

	[Parameter] public RssFeedSources Source { get; set; }

	[Parameter] public string Text { get; set; } = "";

	[Parameter] public bool ShowCount { get; set; }

	[Parameter] public int Count { get; set; }

	[Parameter] public EventCallback<FilterFeedEventArg> OnFilterChanged { get; set; }


	Task SwitchChanged(bool value)
	{
		this._filter = value;

		OnFilterChanged.InvokeAsync(
			new FilterFeedEventArg
			{
				Source = this.Source,
				Value = value
			});

		return Task.CompletedTask;
	}


}