using Lada.Framework.Data.Domains.Crm;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Lada.Framework.Data.Mappings.EntityMappings.Crm
{
    public class CallLogMap : IEntityMappingConfiguration<CallLog>
    {
        public void Map(EntityTypeBuilder<CallLog> builder)
        {
            builder.HasKey(a => a.Id);
            builder.ToTable("CallLogs");

            // Cấu hình các trường decimal
            builder.Property(x => x.BillRate)
                .HasColumnType("decimal(10,2)");

            builder.Property(x => x.BillCost)
                .HasColumnType("decimal(10,2)");

            // Cấu hình các string properties là nullable
            builder.Property(x => x.HistoryID).IsRequired(false);
            builder.Property(x => x.CallID).IsRequired(false);
            builder.Property(x => x.Duration).IsRequired(false);
            builder.Property(x => x.ReasonTerminated).IsRequired(false);
            builder.Property(x => x.FromNo).IsRequired(false);
            builder.Property(x => x.ToNo).IsRequired(false);
            builder.Property(x => x.FromDN).IsRequired(false);
            builder.Property(x => x.ToDN).IsRequired(false);
            builder.Property(x => x.DialNo).IsRequired(false);
            builder.Property(x => x.ReasonChanged).IsRequired(false);
            builder.Property(x => x.FinalNumber).IsRequired(false);
            builder.Property(x => x.FinalDN).IsRequired(false);
            builder.Property(x => x.BillCode).IsRequired(false);
            builder.Property(x => x.BillName).IsRequired(false);
            builder.Property(x => x.Chain).IsRequired(false);
            builder.Property(x => x.FromType).IsRequired(false);
            builder.Property(x => x.ToType).IsRequired(false);
            builder.Property(x => x.FinalType).IsRequired(false);
            builder.Property(x => x.FromDispName).IsRequired(false);
            builder.Property(x => x.ToDispName).IsRequired(false);
            builder.Property(x => x.FinalDispName).IsRequired(false);
            builder.Property(x => x.MissedQueueCalls).IsRequired(false);
            builder.Property(x => x.CallType).IsRequired(false);
            builder.Property(x => x.StatusContent).IsRequired(false);
        }
    }
}
