using Connected.Models;
using Microsoft.AspNetCore.Components;

namespace Connected.Components;
public partial class ToggleInput: InputBase
{
	private bool _checked { get; set; }

	[Parameter]
	public bool? Checked
	{
		get => _checked;
		set => _checked= (bool)value;
	}

	[Parameter, EditorRequired]
	public string Id { get; set; }

	[Parameter]
	public EventCallback<bool> CheckedChanged { get; set; }

	public async Task OnChange()
	{
		Checked = !Checked;
		await CheckedChanged.InvokeAsync((bool)Checked);
	}
}
