using CandyboxPlugin.Recipe;
using Inspectron.HawkEye.View;
using Lindt.Candybox.Demo;
using OpenCvSharp;
using VisionBuilder.UI.Common.Processing;
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
using VisionBuilder.UI.Windows.Settings;

namespace CandyboxPlugin.Module;

public class CandyboxLearningTool: ILearningTool
{
    
    private ImagePreview _activeWindow;
    public CandyboxLearningTool(IImagePreviewService imagePreviewService)
    {
        _activeWindow = (imagePreviewService as WindowsImagePreviewService)!.CurrentWindow!;
    }

    public bool IsLearningEnabled(string recipeName)
    {
        return true;
    }

    public void Learn(string recipeName, Mat image)
    {
        var editor = new MapEditor(image, new HistoRecipe(recipeName));
        editor.ShowDialog(_activeWindow);
    }
}