using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Misc;
namespace FLY.Thick.FilmCasting.Common
{
    public class FilmCastingProfileParam : INotifyPropertyChanged, ICopiable, ICloneable
    {

        #region 正常运行参数
        
        /// <summary>
        /// 产品名称
        /// </summary>
        public string PName { get; set; } = "pname";

        /// <summary>
        /// 批号
        /// </summary>
        public string Batch { get; set; } = "00000001";
        
        /// <summary>
        /// 卷号
        /// </summary>
        public string Number { get; set; } = "1";
        
        /// <summary>
        /// 目标值
        /// </summary>
        public double Target { get; set; } = 100;

        /// <summary>
        /// 公差%
        /// </summary>
        public double TolerancePercent { get; set; } = 0.03;

        /// <summary>
        /// 斜率补偿
        /// </summary>
        public double K { get; set; } = 1;

        /// <summary>
        /// 平移补偿，一般情况没法设置！！！
        /// </summary>
        public double B { get; set; } = 0;

        /// <summary>
        /// 左单边不工作螺丝位
        /// </summary>
        public int LeftEmptyBolts { get; set; } = 1;

        /// <summary>
        /// 右单边不工作螺丝位
        /// </summary>
        public int RightEmptyBolts { get; set; } = 1;

        /// <summary>
        /// 收缩率 
        /// </summary>
        public double UniformShrinkPercent { get; set; } = 0.03;

        /// <summary>
        /// 膜中心位置偏移 mm；
        /// 正常情况膜的中心位置，就是螺丝范围中心位置；
        /// 但切边后，再被测厚仪测量，膜的中心位置就与原来不一致（两边切得不一样）
        /// </summary>
        public int MidOffset { get; set; }

        /// <summary>
        /// 扫描范围，螺丝位, 从 0 开始
        /// </summary>
        public RangeStruct ScanRange { get; set; }

        /// <summary>
        /// 数据范围，螺丝位, 从 0 开始
        /// </summary>
        public RangeStruct DataRange { get; set; }

        /// <summary>
        /// 数据范围 通过边界内缩计算
        /// </summary>
        public bool IsAutoDataRange { get; set; } = true;

        /// <summary>
        /// 单边 切边宽度mm
        /// </summary>
        public int SideCutWidth { get; set; } = 100;
        #endregion

        /// <summary>
        /// 
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            FilmCastingProfileParam p = new FilmCastingProfileParam();
            p.Copy(this);
            return p;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="src"></param>
        public void Copy(object src)
        {
            Misc.PropertiesManager.CopyTo(src, this);
        }
    }
}
