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

namespace SportsDivision.Infrastructure.Repositories;

public class ScoringConstantRepository : Repository<ScoringConstant>, IScoringConstantRepository
{
    public ScoringConstantRepository(ApplicationDbContext context) : base(context) { }
    public override async Task<IEnumerable<ScoringConstant>> GetAllAsync() => await _dbSet.Include(s => s.Event).OrderBy(s => s.Event!.Name).ToListAsync();
    public async Task<ScoringConstant?> GetByEventAsync(int eventId) => await _dbSet.FirstOrDefaultAsync(s => s.EventId == eventId);
}
