using OpenCvSharp;

namespace OpenCVStudio_v0
{
    internal sealed class MorphologyBlockExecutorAdapter : IImageBlockExecutor
    {
        private readonly string blockType;
        private readonly MorphologyOperationMode operation;

        public MorphologyBlockExecutorAdapter(string blockType, MorphologyOperationMode operation)
        {
            this.blockType = blockType;
            this.operation = operation;
        }

        public string BlockType => blockType;

        public Mat Execute(Mat input, ProjectBlock block, ProjectManager projectManager)
        {
            projectManager.SetBlockParameter(block.Id, "Operation", operation);
            MorphologyExecutor executor = new MorphologyExecutor();
            return executor.Execute(input, block, projectManager);
        }
    }
}