using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;

namespace SportsDivision.Infrastructure.Repositories;

public class ZoneRepository : Repository<Zone>, IZoneRepository
{
    public ZoneRepository(ApplicationDbContext context) : base(context) { }
    public async Task<Zone?> GetByCodeAsync(string code) => await _dbSet.FirstOrDefaultAsync(z => z.Code == code);
    public async Task<IEnumerable<Zone>> GetAllWithSchoolsAsync() => await _dbSet.Include(z => z.Schools).OrderBy(z => z.Name).ToListAsync();
}
