using System;
using System.Collections.Generic;
using System.Text;
using static OfficeOpenXml.ExcelErrorValue;

namespace 头罩视野
{
    public static class TestDataStore
    {
        // 单条测试数据
        public class TestRecord
        {
            public int Id { get; set; }
            public string Time { get; set; } = string.Empty;
            public string Date { get; set; } = string.Empty;
            public double LeftEyeArea { get; set; }
            public double RightEyeArea { get; set; }
            public double BinocularArea { get; set; }
            //public double BlankArea { get; set; }
            public double LowerVision { get; set; }
            public double VisionRetentionRate { get; set; }
            public double totalVisionArea { get; set; }
            public double GetVisionRetentionRate { get; set; }

           

        }



        // 所有记录
        public static List<TestRecord> Records { get; } = new List<TestRecord>();
        private static int _nextId = 1;

        public static void AddNewRecord(TestRecord record)
        {
            foreach (var r in Records)
            {
                // 5个字段都一样，就认为是重复
                if (Math.Abs(r.LeftEyeArea - record.LeftEyeArea) < 0.01 &&
                    Math.Abs(r.RightEyeArea - record.RightEyeArea) < 0.01 &&
                    Math.Abs(r.BinocularArea - record.BinocularArea) < 0.01 &&
                    Math.Abs(r.LowerVision - record.LowerVision) < 0.01 &&
                    Math.Abs(r.VisionRetentionRate - record.VisionRetentionRate) < 0.01)
                {
                    // 找到重复，直接return，不添加
                    return;
                }
            }
            record.Id = _nextId++;
            Records.Add(record);
        }


        public static class GlobalData
        {
            // 要传的所有数据放这里
            public static string CurrentMode{ get; set; } = "5";
            public static string JudgmentalPerspective { get; set; } = "空白测试";
            public static double LeftEyeArea { get; set; }
            public static double RightEyeArea { get; set; }
            public static double TotalEyeArea { get; set; }
            public static  double BinocularArea { get; set; }
            public static double BlankArea { get; set; }
            public static double LowerVision { get; set; }//下方视野角度
            public static double VisionRetentionRate { get; set; }

            public static double zsymjValue { get; set; }
            public static double kbsmsyArea { get; set; }
            //public static string LampValueLeft { get; set; } = "左眼开";
            //public static string LampValueRight { get; set; } = "右眼开";
        }

    }
}
