using GreenTree.Strohrmann.ERP.Core.Domain.Shared;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;

namespace GreenTree.Strohrmann.ERP.Domain.Model.Shared
{
    public class TrackedEntityMapping<TEntity> : IEntityTypeConfiguration<TEntity>
        where TEntity : TrackedEntity
    {
        public virtual void Configure(EntityTypeBuilder<TEntity> builder)
        {
            builder.Property(t => t.CreatedOn)
                .IsRequired();

            builder.Property(t => t.CreatedBy)
                .IsRequired();

            builder.Property(t => t.ChangedOn)
                .IsRequired(false);

            builder.Property(t => t.ChangedBy)
                .IsRequired(false);
        }
    }
}