using System.Text.Json;

using Microsoft.AspNetCore.Components;

namespace Integrations.Components.Widgets;
public partial class AdemcoParametersEditor : IModuleSettings
{
	private class Model
	{
		public event Action<Model>? OnChanged;

		public ushort Port { get; set; } = 10001;
	}

	Model Input { get; set; } = new();

	protected override void OnInitialized()
	{
		Input.OnChanged += this.HandleInputChanged;
	}

	private void HandleInputChanged(Model model)
	{
		this.SettingsChanged.InvokeAsync(model);
	}

	[Parameter, EditorRequired]
	public object Settings { get; set; } = null!;
	[Parameter, EditorRequired]
	public EventCallback<object> SettingsChanged { get; set; }
}