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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 根据存款类型、存期查询定期产品信息
    /// 根据存款类型、存期查询定期产品信息
    /// </summary>
    public class QueryFixedDepositProduct : TFOutput
    {
        #region Output
        /// <summary>
        /// 最大开户金额 0390
        /// 
        /// </summary>
        public string ZDKHJE { get; internal set; }

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

        /// <summary>
        /// 产品代码 1031
        /// 
        /// </summary>
        public string CPDM { 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：手输利率（开户日利率）
        /// </summary>
        public string LLLXDQ { get; internal set; }

        /// <summary>
        /// 结算类型(活期) 1035
        /// D结算 S非结算
        /// </summary>
        public string JSLXHQ { 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>
        /// 自动转存限制标志（定期） 103G
        /// Y：允许；N：不允许
        /// </summary>
        public string ZDZCXZBZDQ { get; internal set; }


        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 币种 0210
            /// 01 
            /// </summary>
            public string BZ { get; set; }

            /// <summary>
            /// 存期 0640
            /// (存期类型 Y：年；M：月；D：日) 例如 3M表示3个月 
            /// </summary>
            public string CQ { get; set; }

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


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryFixedDepositProduct();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K040";
                MessageData.Fd21 = BZ;
                MessageData.Fd64 = CQ;
                MessageData.Fd67 = DQCKLXDQ;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.ZDKHJE = DelSpace(MessageData.Fd39);
                output.LL = DelSpace(MessageData.Fd100_5);
                output.CPDM = DelSpace(MessageData.Fd103_1);
                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.JSLXHQ = DelSpace(MessageData.Fd103_5);
                output.JXLX = DelSpace(MessageData.Fd103_6);
                output.ZXKHJE = DelSpace(MessageData.Fd103_7);
                output.ZDZCXZBZDQ = DelSpace(MessageData.Fd103_G);

                return output;
            }
        }
        #endregion
    }
}
