using OpenCvSharp;
using Point = System.Drawing.Point;

namespace CandyboxPlugin.Recipe
{
    public class ProcessingResult
    {
        private readonly Mat _processedImage;
        public List<EErrorReason> ErrorReason { get; } =new List<EErrorReason>();

        public ProcessingResult(Mat image, Mat processedImage, bool error, int elapsedMilliseconds)
        {
            Image = image;
            _processedImage = processedImage;
            Error = error;
            ErrorReason = new List<EErrorReason>();
            ElapsedMilliseconds = elapsedMilliseconds;
        }
        public ProcessingResult(Mat image, Mat processedImage, bool error, int elapsedMilliseconds,List<EErrorReason> errorReason):this(image, processedImage, error, elapsedMilliseconds)
        {
            ErrorReason = errorReason;
        }
        public Mat Image { get; }

        public Mat ProcessedImage
        {
            get
            {
                lock (this)
                {
                    return _processedImage;
                }
            }
        }

        public bool Error { get; }

        public int ElapsedMilliseconds { get;  }
        public List<Point> BlisterRectangle { get; set; }
        public List<int> ErrorPoints { get; set; } = new List<int>();
    }
}