using DbFirst.Domain.Entities;
using Microsoft.EntityFrameworkCore;

namespace DbFirst.Infrastructure;

public class MassDataDbContext : DbContext
{
    public MassDataDbContext(DbContextOptions<MassDataDbContext> options)
        : base(options)
    {
    }

    public virtual DbSet<Massdata> Massdata { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Massdata>(entity =>
        {
            entity.HasKey(e => e.Id);
            entity.ToTable("MASSDATA");

            entity.Property(e => e.Id).HasColumnName("ID");
            entity.Property(e => e.CustomerName)
                .HasMaxLength(200)
                .IsUnicode(false)
                .HasColumnName("CustomerName");
            entity.Property(e => e.Amount)
                .HasColumnType("decimal(12,2)")
                .HasColumnName("Amount");
            entity.Property(e => e.Category)
                .HasMaxLength(100)
                .IsUnicode(false)
                .HasColumnName("Category");
            entity.Property(e => e.StatusFlag)
                .HasColumnName("StatusFlag");
            entity.Property(e => e.AddedWhen)
                .HasColumnType("datetime")
                .HasColumnName("ADDED_WHEN");
            entity.Property(e => e.ChangedWhen)
                .HasColumnType("datetime")
                .HasColumnName("CHANGED_WHEN");
        });
    }
}
