using Hotline.Repository.SqlSugar.DataPermissions;
using Hotline.Settings;
using Hotline.Settings.TimeLimitDomain.Repository;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XF.Domain.Dependency;
using XF.Domain.Repository;

namespace Hotline.Repository.SqlSugar.ExpireTime;
public class TimeLimitSettingAttributeRepository : BaseRepository<TimeLimitSettingAttribute>, ITimeLimitSettingAttributeRepository, IScopeDependency
{
    public TimeLimitSettingAttributeRepository(ISugarUnitOfWork<HotlineDbContext> uow, IDataPermissionFilterBuilder dataPermissionFilterBuilder, IServiceProvider serviceProvider) : base(uow, dataPermissionFilterBuilder, serviceProvider)
    {
    }

    public async Task<TimeLimitSettingAttribute?> GetAsync(string busCode, string name, string value)
        => await base.GetAsync(x => x.Name == name && x.Value == value && x.BusCode == busCode);

    public async Task<TimeLimitSettingAttribute?> GetAsync(string name, string value)
        => await GetAsync(m => m.Name == name && m.Value == value);

    public async Task<TimeLimitSettingAttribute?> GetFuzzyAsync(string busCode, string name, string value)
        => await base.GetAsync(m => m.Name == name && value.Contains(m.Value) && m.BusCode == busCode);
}
