using Concord.API.Future.Client.OrderFormat;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Concord.API.Future.ClientSample.Elves
{
    class FFOrderNewElf
    {
        private string _識別碼;
        /// <summary>
        /// 20103
        /// </summary>
        public string _01_識別碼
        {
            get
            {
                if (_識別碼 == "")
                {
                    _識別碼 = Guid.NewGuid().ToString();
                }
                return _識別碼;
            }
            set
            {
                _識別碼 = value.Trim();
            }
        }
        /// <summary>
        /// 60
        /// </summary>
        public string _02_交易日期 { get; set; }
        /// <summary>
        /// 50
        /// </summary>
        public string _03_分公司碼 { get; set; }
        /// <summary>
        /// 1
        /// </summary>
        public string _04_客戶帳號 { get; set; }
        /// <summary>
        /// 20025
        /// </summary>
        public string _05_市埸別 { get; set; }
        /// <summary>
        /// 20026
        /// </summary>
        public string _06_交易所 { get; set; }
        /// <summary>
        /// 20003
        /// </summary>
        public string _07_單複式別 { get; set; }
        /// <summary>
        /// 20012
        /// </summary>
        public string _08_買賣別1 { get; set; }
        /// <summary>
        /// 20015
        /// </summary>
        public string _09_商品類別1 { get; set; }
        /// <summary>
        /// 20011
        /// </summary>
        public string _10_商品代號1 { get; set; }
        /// <summary>
        /// 20021
        /// </summary>
        public string _11_商品年月1 { get; set; }
        /// <summary>
        /// 20044
        /// </summary>
        public decimal _12_履約價1 { get; set; }
        /// <summary>
        /// 20022
        /// </summary>
        public string _13_買賣權1 { get; set; }
        /// <summary>
        /// 20017
        /// </summary>
        public string _14_買賣別2 { get; set; }
        /// <summary>
        /// 20020
        /// </summary>
        public string _15_商品類別2 { get; set; }
        /// <summary>
        /// 20016
        /// </summary>
        public string _16_商品代號2 { get; set; }
        /// <summary>
        /// 20023
        /// </summary>
        public string _17_商品年月2 { get; set; }
        /// <summary>
        /// 20045
        /// </summary>
        public decimal _18_履約價2 { get; set; }
        /// <summary>
        /// 20024
        /// </summary>
        public string _19_買賣權2 { get; set; }
        /// <summary>
        /// 40
        /// </summary>
        public string _20_委託方式 { get; set; }
        /// <summary>
        /// 20004
        /// </summary>
        public string _21_委託價格正負號 { get; set; }
        /// <summary>
        /// 44
        /// </summary>
        public decimal _22_限價 { get; set; }
        /// <summary>
        /// 20027
        /// </summary>
        public decimal _23_限價分子 { get; set; }
        /// <summary>
        /// 20028
        /// </summary>
        public int _24_限價分母 { get; set; }
        /// <summary>
        /// 99
        /// </summary>
        public decimal _25_停損價 { get; set; }
        /// <summary>
        /// 20029
        /// </summary>
        public decimal _26_停損價分子 { get; set; }
        /// <summary>
        /// 20030
        /// </summary>
        public int _27_停損價分母 { get; set; }
        /// <summary>
        /// 38
        /// </summary>
        public int _28_委託數量 { get; set; }
        /// <summary>
        /// 20032
        /// </summary>
        public string _29_當沖碼 { get; set; }
        /// <summary>
        /// 20031
        /// </summary>
        public string _30_委託條件 { get; set; }
        /// <summary>
        /// 77
        /// </summary>
        public string _31_沖銷別 { get; set; }
        /// <summary>
        /// 10000
        /// </summary>
        public string _32_委託來源別 { get; set; }
        /// <summary>
        /// 20001
        /// </summary>
        public string _33_營業員代號 { get; set; }
        /// <summary>
        /// 21001
        /// </summary>
        public string _34_簽章明文 { get; set; }
        /// <summary>
        /// 21002
        /// </summary>
        public string _35_簽章值 { get; set; }
        /// <summary>
        /// 21003
        /// </summary>
        public string _36_憑證序號 { get; set; }
        /// <summary>
        /// 21004
        /// </summary>
        public string _37_身分證字號 { get; set; }
        /// <summary>
        /// 20048
        /// </summary>
        public string _38_子帳號 { get; set; }
        public FFOrderNew ToConcords()
        {
            FFOrderNew ret = new Client.OrderFormat.FFOrderNew
            {
                bhno = _03_分公司碼,
                cseq = _04_客戶帳號,
                exchange = _06_交易所,
                bs1 = _08_買賣別1,
                commtype1 = _09_商品類別1,
                commo1 = _10_商品代號1,
                commym1 = _11_商品年月1,
                stkPrice1 = _12_履約價1,
                cp1 = _13_買賣權1,
                bs2 = _14_買賣別2,
                commtype2 = _15_商品類別2,
                commo2 = _16_商品代號2,
                commym2 = _17_商品年月2,
                stkPrice2 = _18_履約價2,
                cp2 = _19_買賣權2,
                otype = _20_委託方式,
                price = _22_限價,
                price_numerator = _23_限價分子,
                price_denominator = _24_限價分母,
                stopPrice = _25_停損價,
                stopPrice_numerator = _26_停損價分子,
                stopPrice_denominator = _27_停損價分母,
                qty = _28_委託數量,
                dtFlag = _29_當沖碼,
                rtype = _31_沖銷別,
                idno = _37_身分證字號
            };
            return ret;
        }
        //public override string ToString()
        //{
        //    string ret =
        //        $"20103={_01_識別碼}|60={_02_交易日期}|50={_03_分公司碼}|1={_04_客戶帳號}|20025={_05_市埸別}|" +
        //        $"20026={_06_交易所}|20003{_07_單複式別}|20012={_08_買賣別1}|20015={_09_商品類別1}|20011={_10_商品代號1}" +
        //        $"20021={_11_商品年月1}|20044={_12_履約價1}|20022={_13_買賣權1}|=20017{_14_買賣別2}|20020={_15_商品類別2}" +
        //        $"20016={_16_商品代號2}|20023={_17_商品年月2}|20045={_18_履約價2}|20024={_19_買賣權2}|40={_20_委託方式}" +
        //        $"20004={_21_委託價格正負號}|44={_22_限價}|=20027{_23_限價分子}|20028={_24_限價分母}|99={_25_停損價}" +
        //        $"20029={_26_停損價分子}|20030={_27_停損價分母}|38={_28_委託數量}|20032={_29_當沖碼}|20031={_30_委託條件}" +
        //        $"77={_31_沖銷別}|10000={_32_委託來源別}|20001={_33_營業員代號}|21001={_34_簽章明文}|21002={_35_簽章值}" +
        //        $"21003={_36_憑證序號}|21004={_37_身分證字號}|20048={_38_子帳號}";

        //    return ret;
        //}

    }
}
