using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace labdb.Models;

public record LabTestId : EntityIdBase<LabTestId>;

public class LabTest : EntityBase<LabTestId>
{
    public LabId LabId { get; init; } = null!;
    public Lab Lab { get; init; } = null!;
    public TestId TestId { get; init; } = null!;
    public Test Test { get; init; } = null!;
    public decimal Price { get; set; }
    public string? ServiceDirectoryLink { get; set; }
    public decimal BloodVolume { get; set; }
    public string? TestMethod { get; set; }
    public string? Notes { get; set; }
}

public class LabTestConfiguration : EntityBaseConfiguration<LabTest, LabTestId>
{
    public override void Configure(EntityTypeBuilder<LabTest> builder)
    {
        base.Configure(builder);

        builder.HasIndex(x => x.Price);
        builder.HasIndex(x => x.TestMethod);
        builder.HasIndex(x => x.BloodVolume);
    }
}