using System;
using System.ComponentModel;

namespace OpenCVStudio_v0
{
    internal sealed class ConvexHullProperties
    {
        private readonly ProjectManager projectManager;
        private readonly ProjectBlock block;

        public ConvexHullProperties(ProjectManager projectManager, ProjectBlock block)
        {
            this.projectManager = projectManager ?? throw new ArgumentNullException(nameof(projectManager));
            this.block = block ?? throw new ArgumentNullException(nameof(block));
        }

        [Category("Информация")]
        [DisplayName("Название блока")]
        [ReadOnly(true)]
        public string Name => block.Name;

        [Category("Информация")]
        [DisplayName("Тип блока")]
        [ReadOnly(true)]
        public string BlockType => block.BlockType;

        [Category("Параметры")]
        [DisplayName("Индекс контура")]
        [Description("Номер контура. -1 - обработать все контуры.")]
        public int ContourIndex
        {
            get => projectManager.GetBlockParameter(block.Id, "ContourIndex", -1);
            set => projectManager.SetBlockParameter(block.Id, "ContourIndex", value);
        }

        [Category("Параметры")]
        [DisplayName("Минимальная площадь")]
        [Description("Минимальная площадь контура для построения оболочки.")]
        public double MinArea
        {
            get => projectManager.GetBlockParameter(block.Id, "MinArea", 0.0);
            set => projectManager.SetBlockParameter(block.Id, "MinArea", value);
        }
    }
}