
using Forwarder.Domain;

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Forwarder.Data.Configurations;
/// <summary>
/// Конфигурация сообщений.
/// </summary>
public class MessageConfiguration : IEntityTypeConfiguration<Message>
{
	/// <inheritdoc />
	public void Configure(EntityTypeBuilder<Message> builder)
	{
		_ = builder
			.Property(x => x.Abonent)
			.IsRequired()
			.HasMaxLength(32);

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