using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using OliverBooth.Common.Data.Web.Projects;
namespace OliverBooth.Common.Data.Web.Configuration;
///
/// Represents the configuration for the entity.
///
internal sealed class ProjectConfiguration : IEntityTypeConfiguration
{
///
public void Configure(EntityTypeBuilder builder)
{
builder.ToTable("Project");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).IsRequired();
builder.Property(e => e.Rank).IsRequired();
builder.Property(e => e.Slug).IsRequired();
builder.Property(e => e.Name).IsRequired();
builder.Property(e => e.HeroUrl).IsRequired();
builder.Property(e => e.Description).IsRequired();
builder.Property(e => e.Details).IsRequired();
builder.Property(e => e.Status).HasConversion>().IsRequired();
builder.Property(e => e.RemoteUrl);
builder.Property(e => e.RemoteTarget);
builder.Property(e => e.Tagline);
builder.Property(e => e.Languages).HasConversion(
v => string.Join(' ', v),
s => s.Split(' ', StringSplitOptions.None));
}
}