using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;

namespace CouponReport.Models.CouponMiddleware;

public partial class CouponMiddlewareContext : DbContext
{
    public CouponMiddlewareContext()
    {
    }

    public CouponMiddlewareContext(DbContextOptions<CouponMiddlewareContext> options)
        : base(options)
    {
    }

    public virtual DbSet<CouponConsume> CouponConsumes { get; set; }

    public virtual DbSet<CouponDetail> CouponDetails { get; set; }

    public virtual DbSet<CouponSetting> CouponSettings { get; set; }

    public virtual DbSet<HospitalQrCode> HospitalQrCodes { get; set; }

    public virtual DbSet<Log> Logs { get; set; }

    public virtual DbSet<Member> Members { get; set; }

    public virtual DbSet<MemberConsume> MemberConsumes { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<CouponConsume>(entity =>
        {
            entity.ToTable("CouponConsume");

            entity.Property(e => e.DeviceId)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.DiscountAmount).HasColumnType("decimal(18, 2)");
            entity.Property(e => e.ExternalSystemKey).HasMaxLength(500);
            entity.Property(e => e.PlateNo).HasMaxLength(20);
            entity.Property(e => e.SerialNo)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.SiteId)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.TotalAmount).HasColumnType("decimal(18, 2)");
        });

        modelBuilder.Entity<CouponDetail>(entity =>
        {
            entity.ToTable("CouponDetail");

            entity.Property(e => e.ExternalSystemKey).HasMaxLength(500);
            entity.Property(e => e.Seq).HasMaxLength(3);
            entity.Property(e => e.SerialNo).HasMaxLength(50);
            entity.Property(e => e.Status)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.TransactionId).HasMaxLength(20);
            entity.Property(e => e.Type)
                .HasMaxLength(15)
                .IsUnicode(false);
        });

        modelBuilder.Entity<CouponSetting>(entity =>
        {
            entity.ToTable("CouponSetting");

            entity.Property(e => e.Name).HasMaxLength(20);
            entity.Property(e => e.Url).HasMaxLength(500);
        });

        modelBuilder.Entity<HospitalQrCode>(entity =>
        {
            entity.ToTable("HospitalQrCode");

            entity.Property(e => e.ActivityName).HasMaxLength(50);
            entity.Property(e => e.QrCode).HasMaxLength(100);
        });

        modelBuilder.Entity<Log>(entity =>
        {
            entity.ToTable("Log");

            entity.Property(e => e.DeviceId)
                .HasMaxLength(30)
                .IsUnicode(false);
            entity.Property(e => e.DiscountAmount).HasColumnType("decimal(18, 2)");
            entity.Property(e => e.ExternalSystemKey).HasMaxLength(500);
            entity.Property(e => e.LogType)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.PlateNo).HasMaxLength(20);
            entity.Property(e => e.SerialNo)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.SiteId)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.Status)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.TotalAmount).HasColumnType("decimal(18, 2)");
            entity.Property(e => e.Type)
                .HasMaxLength(10)
                .IsUnicode(false);
        });

        modelBuilder.Entity<Member>(entity =>
        {
            entity.ToTable("Member");

            entity.Property(e => e.MemberId).HasMaxLength(50);
        });

        modelBuilder.Entity<MemberConsume>(entity =>
        {
            entity.ToTable("MemberConsume");

            entity.Property(e => e.MemberId).HasMaxLength(50);
            entity.Property(e => e.PlateNo).HasMaxLength(20);
            entity.Property(e => e.SerialNo)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
