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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 综合授信卡信息查询
    /// 通过授信卡号查询授信信息
    /// </summary>
    public class QueryIntegratedCreditCard : TFOutput
    {
        #region Output
        /// <summary>
        /// 客户号 0280
        /// 
        /// </summary>
        public string KHH { get; internal set; }

        /// <summary>
        /// 第一还款账号 0300
        /// 
        /// </summary>
        public string DYHKZH { get; internal set; }

        /// <summary>
        /// 第二还款账号 0310
        /// 
        /// </summary>
        public string DEHKZH { get; internal set; }

        /// <summary>
        /// 第三还款账号 0320
        /// 
        /// </summary>
        public string DSHKZH { get; internal set; }

        /// <summary>
        /// 签约卡号 0370
        /// 
        /// </summary>
        public string QYKH { get; internal set; }

        /// <summary>
        /// 贷款期限 0500
        /// 
        /// </summary>
        public string DKQX { get; internal set; }

        /// <summary>
        /// POS免息期 0510
        /// 
        /// </summary>
        public string POSMXQ { get; internal set; }

        /// <summary>
        /// 证件号 0620
        /// 
        /// </summary>
        public string ZJH { get; internal set; }

        /// <summary>
        /// 签约状态 0660
        /// 0正常签约1冻结2终止3解约
        /// </summary>
        public string QYZT { get; internal set; }

        /// <summary>
        /// 证件类型 0670
        /// 1.身份证 2.户口簿 3.护照 6.士兵证 7.港澳居民往来内地通行证 8：企业代码证；9：组织机构号；A营业执照；B：经营许可证;C: 事业法人证书 F.外国人永久居留身份证 G.警官证 H.其他证件 I.台湾同胞来往内地通行证 J.军官证
        /// </summary>
        public string ZJLX { get; internal set; }

        /// <summary>
        /// 标志位 0730
        /// [空格表示没有查询相关数据]标志位:[0]输入合同号是否正确/存在[1]验密是否通过[0]输入合同号是否正确/存在(0.是1.否)是否已关联贷款(0.是1.否)[3]是否有该笔授信记录(0 有  1没有)
        /// </summary>
        public string BZW { get; internal set; }

        /// <summary>
        /// 逾期利率比 0840
        /// 
        /// </summary>
        public string YQLLB { get; internal set; }

        /// <summary>
        /// 罚息利率比 0850
        /// 
        /// </summary>
        public string FXLLB { get; internal set; }

        /// <summary>
        /// 复息标志 0930
        /// Y是N不是
        /// </summary>
        public string FXBZ { get; internal set; }

        /// <summary>
        /// 客户名称 0961
        /// 
        /// </summary>
        public string KHMC { get; internal set; }

        /// <summary>
        /// 正常利率比 0970
        /// 
        /// </summary>
        public string ZCLLB { get; internal set; }

        /// <summary>
        /// 最小放款金额 1001
        /// 
        /// </summary>
        public string ZXFKJE { get; internal set; }

        /// <summary>
        /// 授信额度 1002
        /// 
        /// </summary>
        public string SXED { get; internal set; }

        /// <summary>
        /// 剩余授信额度 1003
        /// 
        /// </summary>
        public string SYSXED { get; internal set; }

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

        /// <summary>
        /// 计息方式 1036
        /// 0：不计息；1：利随本清；
        /// </summary>
        public string JXFS { get; internal set; }

        /// <summary>
        /// 还款方式 103C
        /// 1：利随本清；2：按期还息；3：等额本息；4：等本本息； 6：等额递增；7，等额递减；8等比递增；9：等比递减；A：等额气球贷；B：等额上周供
        /// </summary>
        public string HKFS { get; internal set; }

        /// <summary>
        /// 起始日期 1053
        /// 
        /// </summary>
        public string QSRQ { get; internal set; }

        /// <summary>
        /// 到期日期 1054
        /// 
        /// </summary>
        public string DQRQ { get; internal set; }

        /// <summary>
        /// 授信年度 109E
        /// 
        /// </summary>
        public string SXND { get; internal set; }

        /// <summary>
        /// 授信到期日 1122
        /// 授信到期日与前边的到期日期相同
        /// </summary>
        public string SXDQR { get; internal set; }

        /// <summary>
        /// 违约利率 1123
        /// 
        /// </summary>
        public string WYLL { get; internal set; }

        /// <summary>
        /// 逾期利率 1124
        /// 
        /// </summary>
        public string YQLL { get; internal set; }

        /// <summary>
        /// 主副卡标志 115A
        /// 主副卡卡标志1：主卡 2：附卡3：E卡通.默认为1
        /// </summary>
        public string ZFKBZ { get; internal set; }

        /// <summary>
        /// 是否允许POS放款 1215
        /// 0允许1不允许
        /// </summary>
        public string SFYXPOSFK { get; internal set; }

        /// <summary>
        /// 合同号 0740
        /// 
        /// </summary>
        public string HTH { get; internal set; }

        /// <summary>
        /// 合同利率 1005
        /// 
        /// </summary>
        public string HTLL { get; internal set; }

        /// <summary>
        /// 贷款到期日期 0450
        /// 
        /// </summary>
        public string DKDQRQ { get; internal set; }


        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 签约卡号 0370
            ///  
            /// </summary>
            public string QYKH { get; set; }

            /// <summary>
            /// 卡密码 0790
            ///  
            /// </summary>
            public string KMM { get; set; }

            /// <summary>
            /// 合同号 0740
            ///  
            /// </summary>
            public string HTH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryIntegratedCreditCard();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K013";
                MessageData.Fd37 = QYKH;
                MessageData.Fd79 = KMM;
                MessageData.Fd74 = HTH;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.KHH = (MessageData.Fd28);
                output.DYHKZH = (MessageData.Fd30);
                output.DEHKZH = (MessageData.Fd31);
                output.DSHKZH = (MessageData.Fd32);
                output.QYKH = (MessageData.Fd37);
                output.DKQX = (MessageData.Fd50);
                output.POSMXQ = (MessageData.Fd51);
                output.ZJH = (MessageData.Fd62);
                output.QYZT = (MessageData.Fd66);
                output.ZJLX = (MessageData.Fd67);
                output.BZW = (MessageData.Fd73);
                output.YQLLB = (MessageData.Fd84);
                output.FXLLB = (MessageData.Fd85);
                output.FXBZ = (MessageData.Fd93);
                output.KHMC = (MessageData.Fd96_1);
                output.ZCLLB = (MessageData.Fd97);
                output.ZXFKJE = (MessageData.Fd100_1);
                output.SXED = (MessageData.Fd100_2);
                output.SYSXED = (MessageData.Fd100_3);
                output.CPMC = (MessageData.Fd101_F);
                output.JXFS = (MessageData.Fd103_6);
                output.HKFS = (MessageData.Fd103_C);
                output.QSRQ = (MessageData.Fd105_3);
                output.DQRQ = (MessageData.Fd105_4);
                output.SXND = (MessageData.Fd109_E);
                output.SXDQR = (MessageData.Fd112_2);
                output.WYLL = (MessageData.Fd112_3);
                output.YQLL = (MessageData.Fd112_4);
                output.ZFKBZ = (MessageData.Fd115_A);
                output.SFYXPOSFK = (MessageData.Fd121_5);
                output.HTH = (MessageData.Fd74);
                output.HTLL = (MessageData.Fd100_5);
                output.DKDQRQ = (MessageData.Fd45);

                return output;
            }
        }
        #endregion
    }
}
