using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询产品信息
    /// 通过产品代码查询产品信息
    /// </summary>
    public class QueryProductInformation : TFOutput
    {
        #region Output
        /// <summary>
        /// 最大开户金额 0390
        /// 
        /// </summary>
        public string ZDKHJE { get; internal set; }

        /// <summary>
        /// 利率 1005
        /// 基准利率
        /// </summary>
        public string LL { get; internal set; }

        /// <summary>
        /// 产品名称 1032
        /// 
        /// </summary>
        public string CPMC { get; internal set; }

        /// <summary>
        /// 币种 1033
        /// 
        /// </summary>
        public string BZ { get; internal set; }

        /// <summary>
        /// 产品类型 1034
        /// 1活期 2定期 9内部
        /// </summary>
        public string CPLX { get; internal set; }

        /// <summary>
        /// 利率类型（定期）|结算类型（活期） 1035
        /// [定期：0：产品利率（挂牌利率）；1：手输利率（开户日利率）][活期：D结算 S非结算]
        /// </summary>
        public string LLLXDQ { get; internal set; }

        /// <summary>
        /// 计息类型 1036
        /// 0：不计息；1：利随本清；2：按日计息；3：按月计息；4：按季计息；5：按年计息
        /// </summary>
        public string JXLX { get; internal set; }

        /// <summary>
        /// 最小开户金额 1037
        /// 
        /// </summary>
        public string ZXKHJE { get; internal set; }

        /// <summary>
        /// 存期（定期） 103A
        /// 
        /// </summary>
        public string CQDQ { get; internal set; }

        /// <summary>
        /// 存期类型（定期） 103B
        /// Y：年；M：月；D：日
        /// </summary>
        public string CQLXDQ { get; internal set; }

        /// <summary>
        /// 定期存款类型（定期） 103C
        /// 0：整存整取；1：零存整取；2：整存零取；3：存本取息；4：通知存款；5：协议存款；6：定活两便；7：教育储蓄；A: 利润最大化通知存款
        /// </summary>
        public string DQCKLXDQ { get; internal set; }

        /// <summary>
        /// 自动转存限制标志（定期） 103G
        /// Y：允许；N：不允许
        /// </summary>
        public string ZDZCXZBZDQ { get; internal set; }

        /// <summary>
        /// 产品所属科目号 0640
        /// 
        /// </summary>
        public string KMH { get; internal set; }

        /// <summary>
        /// 续存标志 0670
        /// Y：允许；N：不允许
        /// </summary>
        public string XCBZ { get; internal set; }

        /// <summary>
        /// 利率参考上浮比例 0970
        /// 
        /// </summary>
        public string LLSFCK { get; internal set; }

        /// <summary>
        /// 利率最低浮动比例 0840
        /// 活期、定期
        /// </summary>
        public string LLZDFDBL { get; internal set; }

        /// <summary>
        /// 利率最高浮动比例 0850
        /// 活期、定期
        /// </summary>
        public string LLZGFDBL { get; internal set; }

        /// <summary>
        /// 是否手输到期日 0680
        /// Y：允许；N：不允许
        /// </summary>
        public string SFSSDQR { get; internal set; }

        /// <summary>
        /// 市场利率 1123
        /// 根据客户级别在基准利率上浮一定比例
        /// </summary>
        public string SCLL { get; internal set; }


        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 产品代码 1031
            ///  
            /// </summary>
            public string CPDM { get; set; }

            /// <summary>
            /// 客户级别 096J
            ///  
            /// </summary>
            public string KHJB { get; set; }

            /// <summary>
            /// 到期日期 0440
            /// 用于根据存期取利率的产品:定活两便、同业存放、大额储蓄 
            /// </summary>
            public string DQRQ { get; set; }

            /// <summary>
            /// 是否需要开户申请 0690
            /// 即是否需要开户确认，Y：是；N：否 
            /// </summary>
            public string SFXYKHSSQ { get; set; }

            /// <summary>
            /// 是否允许透支 0700
            /// Y：是；N：否，内部账双性产品一般允许 
            /// </summary>
            public string SFYXTZ { get; set; }

            /// <summary>
            /// 起息日期 0450
            /// 用于根据存期取利率的产品:定活两便、同业存放、大额储蓄 
            /// </summary>
            public string QXRQ { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryProductInformation();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K033";
                MessageData.Fd103_1 = CPDM;
                MessageData.Fd96_J = KHJB;
                MessageData.Fd44 = DQRQ;
                MessageData.Fd69 = SFXYKHSSQ;
                MessageData.Fd70 = SFYXTZ;
                MessageData.Fd45 = QXRQ;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.ZDKHJE = (MessageData.Fd39);
                output.LL = (MessageData.Fd100_5);
                output.CPMC = DelSpace(MessageData.Fd103_2);
                output.BZ = DelSpace(MessageData.Fd103_3);
                output.CPLX = DelSpace(MessageData.Fd103_4);
                output.LLLXDQ = DelSpace(MessageData.Fd103_5);
                output.JXLX = DelSpace(MessageData.Fd103_6);
                output.ZXKHJE = (MessageData.Fd103_7);
                output.CQDQ = (MessageData.Fd103_A);
                output.CQLXDQ = DelSpace(MessageData.Fd103_B);
                output.DQCKLXDQ = DelSpace(MessageData.Fd103_C);
                output.ZDZCXZBZDQ = DelSpace(MessageData.Fd103_G);
                output.KMH = (MessageData.Fd64);
                output.XCBZ = (MessageData.Fd67);
                output.LLSFCK = (MessageData.Fd97);
                output.LLZDFDBL = (MessageData.Fd84);
                output.LLZGFDBL = (MessageData.Fd85);
                output.SFSSDQR = (MessageData.Fd68);
                output.SCLL = (MessageData.Fd112_3);

                return output;
            }
        }
        #endregion
    }
}
