using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LolDataRequestLib.ResponseData
{
    class 용데이터 : IResponseData
    {


        public DataTable 디비데이터를데이터테이블로만듬()
        {

            DataTable 용리스폰테이블 = new DataTable(DBDefine.요청데이터분류.용리스폰.ToString());


            용리스폰테이블.Columns.Add("용정보");
            용리스폰테이블.Columns.Add("리스폰타임");
  

            if (DataManager.getInstance().드래곤리스폰 == null)
            {
                return 용리스폰테이블;
            }

            BsonDocument dd = DataManager.getInstance().드래곤리스폰.DeepClone().AsBsonDocument;

            dd.Remove("sequenceIndex");

            List<BsonElement> bufStructDataList = dd.ToList();

            foreach (BsonElement item in bufStructDataList)
            {
                DataRow bufRow = 용리스폰테이블.NewRow();

                BsonDocument bufValue = item.Value.AsBsonDocument;

                bufRow["용정보"] = bufValue["nextDragonName"].ToString();

                int 용리스폰타임 = bufValue["nextDragonSpawnTime"].ToInt32();
                bufRow["리스폰타임"] = 용리스폰타임;
           
                용리스폰테이블.Rows.Add(bufRow);
            }

            return 용리스폰테이블;

        }

    }
}