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

namespace FrontendWebApi.Models
{
    public class ErrorCode
    {
        Dictionary<string, string> errorrCode = new Dictionary<string, string>()
        {
            { "0000", "成功" },
            { "0001", "查無資料" },
            { "5000", "無效的JWT"},
            { "9996", "查無該常用組合" },
            { "9997", "輸入條件不足,請重新確認輸入條件" },
            { "9998", "帳號或密碼輸入錯誤"},
            { "9999", "系統內部錯誤,請聯絡管理者"}
        };

        /// <summary>
        /// 取得錯誤代碼字串
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public string GetString(string code)
        {
            if (true == (errorrCode.ContainsKey(code)))
            {
                return errorrCode[code];
            }
            else
            {
                return "查無代碼";
            }
        }
    }
}