using System;
using Microsoft.AspNetCore.Components;
using TestDialogManager.Services;

namespace TestDialogManager.Components
{
    public abstract class DialogComponentBase : ComponentBase
    {
        private Guid _id;
        [Inject] public RendererService RendererService { get; set; }

        [Parameter]
        public Guid Id
        {
            get => _id;
            set
            {
                Console.WriteLine($"Id set to {value}");
                _id = value;
            }
        }

        protected void Close()
        {
            RendererService.RemoveRender(Id);
        }

        protected DialogComponentBase()
        {
            Console.WriteLine("New DialogComponentBase()");
        }
    }
}
