using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Tokens;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

namespace SlnMesnac.Repository.service.Impl
{
    public class RecordStaffCommuteServiceImpl : BaseServiceImpl<RecordStaffCommute>, IRecordStaffCommuteService
    {
        private readonly ILogger<RecordStaffCommute> _logger;

        public RecordStaffCommuteServiceImpl(Repository<RecordStaffCommute> rep, ILogger<RecordStaffCommute> logger) : base(rep)
        {
            _logger = logger;
        }

        public List<RecordStaffCommute> GetRecordStaffCommutes()
        {
            return null;
        }

        public RecordStaffCommute GetStaffCommuteByIdAndDuration(string id, string currentTime)
        {
            RecordStaffCommute recordStaffCommute = _rep.AsQueryable().Where(x => x.StaffId == id).Where(x => Convert.ToDateTime(x.StartWorkTime).AddHours(10) > Convert.ToDateTime(currentTime)).First();
            return recordStaffCommute;
        }
    }
}
