using AutoMapper;

using CloudGaming.AppConfigModel;
using CloudGaming.Code.DataAccess;
using CloudGaming.DtoModel;
using CloudGaming.DtoModel.Game;

using HuanMeng.DotNetCore.CacheHelper;
using HuanMeng.DotNetCore.Redis;

using StackExchange.Redis;

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

namespace CloudGaming.Code.Cache.Special
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="dao"></param>
    /// <param name="database"></param>
    /// <param name="mapper"></param>
    /// <param name="appConfig"></param>
    public class AppConfigEntityCache(DAO dao, IDatabase database, IMapper mapper, AppConfig appConfig) : RedisDataEntityCache<AppConfigCache>(database, 0, "系统配置")
    {
        public override string key => $"cache:appconfig:list";

        public override List<AppConfigCache> GetDataList()
        {
            var list = dao.DaoExt.Context.T_App_Config.Where(it => it.ConfigType != (int)AppConfigType.协议配置).ToList();
            var appList = mapper.Map<List<AppConfigCache>>(list);
            return appList;

        }
    }
}
