using FLY.Thick.Base.Common;
using FLY.Thick.FilmCasting.IService;
using FObjBase;
using FObjBase.Reflect;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FLY.Thick.FilmCasting.Client
{
    public class BoltMapFilmCastingServiceClient: FObjBase.Reflect.Reflect_SeviceClient, IBoltMapFilmCastingService
    {
        protected override Type InterfaceType => typeof(IBoltMapFilmCastingService);

        public BoltMapFilmCastingServiceClient(UInt32 serviceId) : base(serviceId) { }
        public BoltMapFilmCastingServiceClient(UInt32 serviceId, string connName) : base(serviceId, connName) { }

        #region 设定
        /// <summary>
        /// 螺丝宽度 mm, 是double, 那就可以设置英寸
        /// </summary>
        public double BoltWidth { get; set; }

        /// <summary>
        /// 总螺丝数 
        /// </summary>
        public int BoltCnt { get; set; }


        /// <summary>
        /// 与机架方向相反
        /// </summary>
        public bool IsReversed { get; set; }

        /// <summary>
        /// 平滑，以前后分区平均滤波 ，=0，只有自己，1，左右各一个
        /// </summary>
        public int Smooth { get; set; }

        #endregion


        #region 状态

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

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

        /// <summary>
        /// 收缩率  Uniform(均匀区)Shrink(收缩)Percent(比例)
        /// </summary>
        public double UniformShrinkPercent { get; set; }

        /// <summary>
        /// 膜中心位置偏移 mm
        /// </summary>
        public int MidOffset { get; set; }

        /// <summary>
        /// 总分区数
        /// </summary>
        public int NBolts { get; set; }

        /// <summary>
        /// 第1个分区号
        /// </summary>
        public int FirstBoltNo { get; set; }

        #endregion


        public DateTime DebugUpdate { get; set; }

        [Call(typeof(BoltMapFilmCastingDebugData))]
        public void GetDebugData(AsyncCBHandler asyncDelegate, object asyncContext) 
        {
            Call(nameof(GetDebugData), null, asyncDelegate, asyncContext);
        }

        /// <summary>
        /// 应用
        /// </summary>
        public void Apply() 
        {
            Call(nameof(Apply));
        }
    }
}
