using OpenAuth.App.BaseApp.Base;
using OpenAuth.App.Interface;
using OpenAuth.Repository.Domain.FireManagement;
using OpenAuth.Repository;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Infrastructure;

namespace OpenAuth.App.ServiceApp.FireManagement
{
    public class FirePatrolApp : SqlSugarBaseApp<FmUserTimeSlot, SugarDbContext>
    {
        public FirePatrolApp(ISugarUnitOfWork<SugarDbContext> unitWork,
        ISimpleClient<FmUserTimeSlot> repository, IAuth auth) : base(unitWork, repository, auth)
        {
            _auth = auth;
        }
        public async Task<Response<bool>> GetPatrolInfoByUserId(long id, DateTime beginTime, DateTime endTime)
        {
            using (SugarDbContext db = base.UnitWork.CreateContext())
            {
                var usertime = await db.FmUserTimeSlot.AsQueryable().Where(a => a.CreateId == id).ToListAsync();
                var user = await db.User.GetFirstAsync(r => r.Id == id);
                TimeSpan timeSpan = endTime.AddDays(1).Subtract(beginTime);
                int days = (int)timeSpan.TotalDays;

                
                return new Response<bool> { Result = false, Message = "操作失败" };

            }
        }
    }
}
