using Microsoft.EntityFrameworkCore;
using MTWorkHR.Core.Entities;
using MTWorkHR.Core.IDto;
using MTWorkHR.Core.IRepositories;
using MTWorkHR.Infrastructure.Entities;
using MTWorkHR.Infrastructure.DBContext;

namespace MTWorkHR.Infrastructure.Repositories
{
    public class CompanyRepository : Repository<Company>, ICompanyRepository
    {
        private readonly DbSet<Company> dbSet;
   
        public CompanyRepository(HRDataContext context) : base(context)
        {
            dbSet = context.Set<Company>();

          
        }
        public async Task<Company> GetByIdWithAllChildren(long id)
        {
            return await dbSet
                .Include(x => x.City)
                .Include(x => x.Country)
                .FirstOrDefaultAsync(x => x.Id == id);
        }
    }
}