using System;
using System.ComponentModel;

namespace OpenCVStudio_v0
{
    public sealed class SepFilter2DBlockProperties
    {
        private readonly ProjectManager projectManager;
        private readonly ProjectBlock block;
        private SepFilterKernel kernel;

        public SepFilter2DBlockProperties(ProjectManager projectManager, ProjectBlock block)
        {
            this.projectManager = projectManager ?? throw new ArgumentNullException(nameof(projectManager));
            this.block = block ?? throw new ArgumentNullException(nameof(block));
            kernel = projectManager.GetBlockParameter(block.Id, "Kernel", SepFilterKernel.Identity);
        }

        [Category("Фильтр")]
        [DisplayName("Ядро")]
        public SepFilterKernel Kernel
        {
            get => kernel;
            set
            {
                kernel = value;
                projectManager.SetBlockParameter(block.Id, "Kernel", value);
            }
        }

        [Category("Блок")]
        [ReadOnly(true)]
        public string Name => block.Name;
    }
}