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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询委托协议登记信息
    /// 通过委托编号查询委托协议信息
    /// </summary>
    public class QueryDelegateRegistration : TFOutput
    {
        #region Output
        /// <summary>
        /// 币种 0210
        /// 参考mo_trust_prot中cur_no字段
        /// </summary>
        public string BZ { get; internal set; }

        /// <summary>
        /// 委托贷款人户名 0250
        /// 参考mo_trust_prot中name字段
        /// </summary>
        public string WTDKRHM { get; internal set; }

        /// <summary>
        /// 公积金账号/委托户账号 0300
        /// 参考mo_trust_prot中afund_ac_id字段并转换为mdm_ac_rel中ac_no字段
        /// </summary>
        public string GJJZHWTHZH { get; internal set; }

        /// <summary>
        /// 本金归还账号 0310
        /// 参考mo_trust_prot中amt_ac_id字段并转换为mdm_ac_rel中ac_no字段
        /// </summary>
        public string BJGHZH { get; internal set; }

        /// <summary>
        /// 利息收入账号 0320
        /// 参考mo_trust_prot中intst_ac_id字段并转换为mdm_ac_rel中ac_no字段
        /// </summary>
        public string LXSRZH { get; internal set; }

        /// <summary>
        /// 贷款账号 0330
        /// 参考mo_trust_prot中ln_ac_id字段并转换为mdm_ac_rel中ac_no字段
        /// </summary>
        public string DKZH { get; internal set; }

        /// <summary>
        /// 贷款序号 0340
        /// 参考mo_trust_prot中ln_ac_seqn字段
        /// </summary>
        public string DKXH { get; internal set; }

        /// <summary>
        /// 委托金额 0400
        /// 参考mo_trust_prot中trust_amt字段
        /// </summary>
        public string WTJE { get; internal set; }

        /// <summary>
        /// 已委托金额 0410
        /// 参考mo_trust_prot中out_amt字段
        /// </summary>
        public string YWTJE { get; internal set; }

        /// <summary>
        /// 分成比例 0420
        /// 参考mo_trust_prot中chrg_pro字段
        /// </summary>
        public string FCBL { get; internal set; }

        /// <summary>
        /// 交易机构号 0640
        /// 参考mo_trust_prot中tx_br_no字段
        /// </summary>
        public string JYJGH { get; internal set; }

        /// <summary>
        /// 委托贷款标志 0670
        /// 参考mo_trust_prot中trust_ind字段
        /// </summary>
        public string WTDKBZ { get; internal set; }

        /// <summary>
        /// 状态 0680
        /// 参考mo_trust_prot中sts字段
        /// </summary>
        public string ZT { get; internal set; }

        /// <summary>
        /// 手续费率 0840
        /// 参考mo_trust_prot中fee_rate字段
        /// </summary>
        public string SXFL { get; internal set; }

        /// <summary>
        /// 委托关联标志 0690
        /// Y-已委托关联 N-未委托关联
        /// </summary>
        public string WTGLBZ { get; internal set; }


        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 委托编号 0380
            /// (null) 
            /// </summary>
            public string WTBH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryDelegateRegistration();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K012";
                MessageData.Fd38 = WTBH;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.BZ = (MessageData.Fd21);
                output.WTDKRHM = (MessageData.Fd25);
                output.GJJZHWTHZH = (MessageData.Fd30);
                output.BJGHZH = (MessageData.Fd31);
                output.LXSRZH = (MessageData.Fd32);
                output.DKZH = (MessageData.Fd33);
                output.DKXH = (MessageData.Fd34);
                output.WTJE = (MessageData.Fd40);
                output.YWTJE = (MessageData.Fd41);
                output.FCBL = (MessageData.Fd42);
                output.JYJGH = (MessageData.Fd64);
                output.WTDKBZ = (MessageData.Fd67);
                output.ZT = (MessageData.Fd68);
                output.SXFL = (MessageData.Fd84);
                output.WTGLBZ = (MessageData.Fd69);

                return output;
            }
        }
        #endregion
    }
}
