
using MTWorkHR.Application.Models;
using MTWorkHR.Core.UnitOfWork;
using MTWorkHR.Application.Services.Interfaces;
using MTWorkHR.Core.Entities;
using Microsoft.AspNetCore.Identity;
using MTWorkHR.Application.Mapper;
using MTWorkHR.Core.Global;
using MTWorkHR.Infrastructure.Entities;
using MTWorkHR.Infrastructure.Repositories;
using MTWorkHR.Infrastructure.UnitOfWorks;
using MTWorkHR.Core.IRepositories.Base;

namespace MTWorkHR.Application.Services
{
    public class UserTaskHistoryService : BaseService<UserTaskHistory, UserTaskHistoryDto, UserTaskHistoryDto>, IUserTaskHistoryService
    {
        private readonly IUnitOfWork _unitOfWork;

        public UserTaskHistoryService(IUnitOfWork unitOfWork) : base(unitOfWork)
        {
            _unitOfWork = unitOfWork;
        }


        //public override async Task<UserTaskHistoryDto> GetById(long id)
        //{
        //    var entity = await _unitOfWork.UserTaskAttachment.GetByIdAsync(id);
        //    var response = MapperObject.Mapper.Map<UserTaskHistoryDto>(entity);
        //    return response;
        //}

  


        //public override async Task<UserTaskHistoryDto> Create(UserTaskHistoryDto input)
        //{          
        //    var entity = MapperObject.Mapper.Map<UserTaskAttachment>(input);
        //    if (entity is null)
        //    {
        //        throw new AppException(ExceptionEnum.MapperIssue);
        //    }

        //    var task = await _unitOfWork.UserTaskAttachment.AddAsync(entity);
        //    await _unitOfWork.CompleteAsync();

        //    var response = MapperObject.Mapper.Map<UserTaskHistoryDto>(task);
        //    return response;
        //}


        //public override async Task<UserTaskHistoryDto> Update(UserTaskHistoryDto input)
        //{
        //    var entitiy = await _unitOfWork.UserTask.GetByIdAsync(input.Id);

        //    if (entitiy == null)
        //        throw new AppException(ExceptionEnum.RecordNotExist);

        //    MapperObject.Mapper.Map(input, entitiy, typeof(UserTaskHistoryDto), typeof(UserTaskHistory));

        //    await _unitOfWork.CompleteAsync();

        //    return input;
        //}
    }
}
