using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace LolDataRequestLib
{
    /// <summary>
    /// DB와 MAnager간의 데이터의 정의에 관련된 클래스.
    /// </summary
    public static class DBDefine
    {

        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@211.42.188.8:50003";
        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@211.53.30.8:50003";

        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@localhost:50003";        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@203.251.148.27:50002";
        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@121.131.226.38:50003";
        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@14.39.226.156:50003";

        public static string MONGODB주소 = "mongodb://root:veryhardpassword123@121.131.226.37:50003";

        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@192.168.200.178:50003";
        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@211.171.119.9:50003";
        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@10.100.9.186:50003"
        //;

        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@211.171.119.9:50003";

        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@localhost:50003"; 

        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@14.39.226.145:50003";
        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@192.168.0.92:50003";
        //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@218.152.33.43:50003"; //사무실


        internal static string 챔피언데이터파일경로 = "data/ko_KR/champion.json";

        internal static string 룬데이터파일경로 = "data/en_US/runesReforged.json";




        public static void 디비변경(string recvDBAddress)
        {

            MONGODB주소 = "mongodb://root:veryhardpassword123@"+recvDBAddress+":50003";

        }
        

        public enum 서버의답변
        {
            방을찾았고업데이트를시작함,
            방을못찾아서업데이트를못함,
            이미방을업데이트중임,
            명령이틀림,
            서버와의연결이이상함
        }

        public enum 요청데이터분류
        {
            [StringValue("밴데이터")]
            밴데이터,
            [StringValue("픽데이터")]
            픽데이터,
            [StringValue("현재골드량선수")]
            현재골드량선수,
            [StringValue("현재데미지량선수")]
            현재데미지량선수,
            [StringValue("경험치레벨")]
            경험치레벨,
            [StringValue("오브젝트킬")]
            오브젝트킬,
            [StringValue("룬데이터")]
            룬데이터,
            [StringValue("골드차이팀")]
            골드차이팀,
            [StringValue("타워철거전체")]
            타워철거전체,
            [StringValue("타워골드데이터")]
            타워골드데이터,
            [StringValue("경기종료정보")]
            경기종료정보,
            [StringValue("팟지")]
            팟지,
            [StringValue("킬뎃어시")]
            킬뎃어시,
            [StringValue("용리스폰")]
            용리스폰,
            //[StringValue("아타칸리스폰")]
            //아타칸리스폰,
            [StringValue("한타딜량범위")]
            한타딜량범위,
            [StringValue("퀘스트완료여부")]
            퀘스트완료여부

        }


        public enum RequestDataType
        {
            BAN_AND_PICK,
            GAME_STATUS,
            OBJECT_EVENT,
            DRAGON_RESPAWN,
            ATAKHAN_RESPAWN,
            STRUCT_EVENT,
            STRUCT_GOLD_EVENT
        }

        public enum 팀구분
        {
            블루 = 100,
            퍼플 = 200
        }

        public enum 라인구분
        {
            탑라이너 = 1,
            정글러 = 2,
            미드라이너 = 3,
            바텀라이너 = 4,
            서포터 = 5
        }

        public enum 픽상태구분
        {
            선택안함 = 0,
            고르는중 = 1,
            선택확정 = 2
        }

        
        public static string GetStringValue(this Enum value)
        {
            // Get the type
            Type type = value.GetType();

            // Get fieldinfo for this type
            FieldInfo fieldInfo = type.GetField(value.ToString());

            // Get the stringvalue attributes
            StringValueAttribute[] attribs = fieldInfo.GetCustomAttributes(
                typeof(StringValueAttribute), false) as StringValueAttribute[];

            // Return the first if there was a match.
            return attribs.Length > 0 ? attribs[0].StringValue : null;
        }


        public class StringValueAttribute : Attribute
        {

            #region Properties

            /// <summary>
            /// Holds the stringvalue for a value in an enum.
            /// </summary>
            public string StringValue { get; protected set; }

            #endregion

            #region Constructor

            /// <summary>
            /// Constructor used to init a StringValue Attribute
            /// </summary>
            /// <param name="value"></param>
            public StringValueAttribute(string value)
            {
                this.StringValue = value;
            }

            #endregion

        }

    }


}
