using FLY.FilmCasting.AutoDie.IService;
using FObjBase;
using FObjBase.Reflect;
using Newtonsoft.Json;
using System;

namespace FLY.FilmCasting.AutoDie.Client
{
    public class BulkDbServiceClient : FObjBase.Reflect.Reflect_SeviceClient, IBulkDbService
    {
        protected override Type InterfaceType => typeof(IBulkDbService);

        public long LastId { get; set; }

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


        public void GetFrame(long Id, AsyncCBHandler asyncDelegate, object asyncContext)
        {
            Call(nameof(GetFrame), new { Id }, asyncDelegate, asyncContext);
        }

        /// <summary>
        /// 获取一幅稳定的数据;
        /// </summary>
        /// <param name="Id">以Id为起始点, 向前或者向后或者最近稳定的一幅数据</param>
        /// <param name="isPre"></param>
        /// <param name="asyncDelegate"></param>
        /// <param name="asyncContext"></param>
        [Call(typeof(GetStableFrameReponse))]
        public void GetStableFrame(long id, bool isPre, AsyncCBHandler asyncDelegate, object asyncContext)
        {
            Call(nameof(GetStableFrame), new { id, isPre }, asyncDelegate, asyncContext);
        }

        /// <summary>
        /// 以Id为起始点, 向前或者向后获取最近通道改变时间不相同的数据 或 起效数据
        /// </summary>
        /// <param name="id"></param>
        /// <param name="isPre">向前</param>
        /// <param name="isTakeEffect">数据起效</param>
        /// <param name="isDiffCTime">加热不同</param>
        /// <param name="asyncDelegate"></param>
        /// <param name="asyncContext"></param>
        [Call(typeof(GetFrameReponse))]
        public void GetFrameAdv(long id, bool isPre, bool isTakeEffect, bool isDiffCTime, AsyncCBHandler asyncDelegate, object asyncContext) 
        {
            Call(nameof(GetFrameAdv), new { id, isPre, isTakeEffect, isDiffCTime }, asyncDelegate, asyncContext);
        }
    }
}

