using LinqToDB;
using MasaBlazorApp3.DataAccess.Dao;
using MasaBlazorApp3.Pojo;
using MasaBlazorApp3.Pojo.Config;
using MasaBlazorApp3.Port;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MasaBlazorApp3.DataAccess.Impl
{
    public class SettingManuDao : ISettingManuDao
    {
        private AppDataConnection _connection;
        private readonly SettingConfig _setting;
        private GlobalStateService _globalStateService;
        public SettingManuDao(AppDataConnection connection, IOptions<SettingConfig> setting, GlobalStateService globalStateService, PortUtil portUtil)
        {
            _globalStateService = globalStateService;
            _connection = connection;
            _setting = setting.Value;
        }
        public async Task<List<SettingManu>> GetMenuItemsAsync()
        {
            var query = _connection.SettingManu.Where(s=>s.UseStatus==1).AsQueryable();


            return await query
                .OrderBy((sm) => sm.Id)
                .ToListAsync();
        }
    }
}
