using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using TeleWave.Domain.Media;

namespace TeleWave.Infrastructure.Persistence.Configurations;

public class MediaAssetConfiguration : IEntityTypeConfiguration<MediaAsset>
{
    public void Configure(EntityTypeBuilder<MediaAsset> builder)
    {
        builder.Property(x => x.OriginalFileName).IsRequired().HasMaxLength(512);
        builder.Property(x => x.OriginalExtension).IsRequired().HasMaxLength(16);
        builder.Property(x => x.VideoCodec).HasMaxLength(32);
        builder.Property(x => x.AudioCodec).HasMaxLength(32);
        builder.Property(x => x.RelativePath).HasMaxLength(256);
        builder.Property(x => x.ErrorMessage).HasMaxLength(2048);

        builder.HasIndex(x => x.Status);
        builder.HasIndex(x => x.CreatedAt);
    }
}
