using System.Collections.Generic;
using XP.Hardware.Detector.Abstractions.Enums;

namespace XP.Hardware.Detector.Config
{
    /// <summary>
    /// iRay 探测器配置类 | iRay detector configuration class
    /// 包含 iRay 专属的配置参数
    /// </summary>
    public class IRayDetectorConfig : DetectorConfig
    {
        /// <summary>
        /// 默认增益值 | Default gain value
        /// </summary>
        public double DefaultGain { get; set; } = 1.0;

        /// <summary>
        /// 采集模式 | Acquisition mode
        /// </summary>
        public AcquisitionMode AcquisitionMode { get; set; } = AcquisitionMode.Continuous;

        /// <summary>
        /// iRay 支持 1×1、2×2、3×3、4×4 四种 Binning | iRay supports 1×1, 2×2, 3×3, 4×4 binning
        /// </summary>
        public override List<BinningOption> GetSupportedBinnings()
        {
            return new List<BinningOption>
            {
                new BinningOption("1×1", 0),
                new BinningOption("2×2", 1),
                new BinningOption("3×3", 2),
                new BinningOption("4×4", 3),
            };
        }

        /// <summary>
        /// iRay PGA 范围 1-8 | iRay PGA range 1-8
        /// </summary>
        public override List<int> GetSupportedPgaValues()
        {
            return new List<int> { 1, 2, 3, 4, 5, 6, 7, 8 };
        }

        /// <summary>
        /// iRay 各 Binning 模式最大帧率 | iRay max frame rate per binning mode
        /// </summary>
        public override decimal GetMaxFrameRate(int binningIndex) => binningIndex switch
        {
            0 => 15m,   // 1×1
            1 => 30m,   // 2×2
            2 => 45m,   // 3×3
            3 => 60m,   // 4×4
            _ => 15m
        };
    }
}
