using Hotline.Repository.SqlSugar.DataPermissions;
using Hotline.Settings.TimeLimits;
using Hotline.Tools;
using SqlSugar;
using XF.Domain.Dependency;

namespace Hotline.Repository.SqlSugar.System
{
    public class DaySettingRepository : BaseRepository<DaySetting>, IDaySettingRepository, IScopeDependency
    {
        public DaySettingRepository(ISugarUnitOfWork<HotlineDbContext> uow, IDataPermissionFilterBuilder dataPermissionFilterBuilder, IServiceProvider serviceProvider) : base(uow, dataPermissionFilterBuilder, serviceProvider)
        {
        }

        //public async Task<bool> IsWorkDay(DateTime date)
        //{
        //    var model = await Db.Queryable<DaySetting>().FirstAsync(x=> x.Day.Date == date.Date);
        //    if (model!=null)
        //    {
        //        return model.IsWorkDay;
        //    }
        //    return WeekTool.IsWorkDay(date);
        //}


        public async Task<List<DaySetting>> GetDaySettingsByMonth(int year,int month)
        {
            return await Db.Queryable<DaySetting>().Where(x => x.Day.Year == year && x.Day.Month == month).ToListAsync();
        }

    }
}
