// Copyright © Selmo Technology GmbH. All Rights Reserved

using Microsoft.AspNetCore.Components;

namespace SelmoStudio.Hmi.Server.Shared.Components.BaseComponents
{
    public partial class RotarySwitchComponent
    {
        [Parameter]
        public bool State { get; set; }

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

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

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

        private async Task OnClick()
        {
            if (Disabled)
            {
                return;
            }

            State = !State;

            await CallBack.InvokeAsync(State);
        }
    }
}