using GerbilManagerWebAPI.DAL; using GerbilManagerWebAPI.Dtos; using GerbilManagerWebAPI.Genetics; using Microsoft.AspNetCore.Mvc; namespace GerbilManagerWebAPI.Controllers { /// /// Inbreeding-coefficient (Inzuchtkoeffizient) endpoints — both for an existing /// gerbil and for a hypothetical pairing (Probeverpaarung). /// [ApiController] public class InbreedingController : ControllerBase { private readonly InbreedingService service; // ApplicationContext is already registered in DI; the service is a thin, // dependency-free wrapper so it needs no separate registration in Program.cs. public InbreedingController(ApplicationContext db) { service = new InbreedingService(db); } // GET /gerbils/{id}/inbreeding-coefficient [HttpGet("gerbils/{id}/inbreeding-coefficient")] public ActionResult GetForGerbil(Guid id) { var result = service.ForGerbil(id); return result is null ? NotFound() : result; } // POST /genetics/test-inbreeding [HttpPost("genetics/test-inbreeding")] public ActionResult TestPairing(TestInbreedingDto dto) { return service.ForPairing(dto.FatherId, dto.MotherId); } } }