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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询还款顺序表
    /// 查询贷款还款顺序表返回相关列表信息
    /// </summary>
    public class QueryRevertLoanList : TFOutput
    {
        #region Output
        /// <summary>
        /// 顺序列表
        /// 返回文件，主要内容：还款顺序代码|@还款序号|@处理方式|
        /// </summary>
        public string SXLB { get; internal set; }

        /// <summary>
        /// 顺序列表
        /// 返回文件，主要内容：还款顺序代码|@还款序号|@处理方式|
        /// </summary>
        public List<E_SXLB> SXLBData { get; internal set; }

        /// <summary>
        /// 顺序列表
        /// 返回文件，主要内容：还款顺序代码|@还款序号|@处理方式|
        /// </summary>
        public class E_SXLB
        {
            /// <summary>
            /// 还款顺序代码
            /// </summary>
            public string HKSXDM { get; set; }

            /// <summary>
            /// @还款序号
            /// </summary>
            public string @HKXH { get; set; }

            /// <summary>
            /// @处理方式
            /// </summary>
            public string @CLFS { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {

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

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.SXLBData = AnilyzeFileData<E_SXLB>(MessageData.FileData,
                                            "还款顺序代码|@还款序号|@处理方式|",
                                            x =>
                                            {
                                                return new E_SXLB
                                                {
                                                    HKSXDM = x["还款顺序代码"],
                                                    @HKXH = x["@还款序号"],
                                                    @CLFS = x["@处理方式"]
                                                };
                                            });
                output.SXLB = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
