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

namespace DAL.PGModels;

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

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

    public virtual DbSet<BlockIplog> BlockIplogs { get; set; }

    public virtual DbSet<BlsHotelsList> BlsHotelsLists { get; set; }

    public virtual DbSet<DevMonitorlog> DevMonitorlogs { get; set; }

    public virtual DbSet<Excelgenerater> Excelgeneraters { get; set; }

    public virtual DbSet<Qingao> Qingaos { get; set; }

    public virtual DbSet<Recordhotel> Recordhotels { get; set; }

    public virtual DbSet<SkyworthTvMonitorlog> SkyworthTvMonitorlogs { get; set; }

    public virtual DbSet<StatisticsTotal> StatisticsTotals { get; set; }

    public virtual DbSet<TclTvMonitorlog> TclTvMonitorlogs { get; set; }

    public virtual DbSet<WebapiMonitorlog> WebapiMonitorlogs { get; set; }

//    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
//#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
//        => optionsBuilder.UseNpgsql("Server=10.8.8.208;Database=postgres;user id=postgres;password=blw#1234^_^;port=15432;");

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<BlockIplog>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("BlockIPLog_pkey");

            entity.ToTable("BlockIPLog");

            entity.Property(e => e.Id).HasColumnName("ID");
            entity.Property(e => e.CreateTime).HasColumnType("timestamp(6) without time zone");
            entity.Property(e => e.Human).HasMaxLength(255);
        });

        modelBuilder.Entity<BlsHotelsList>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("BLS_Hotels_List_pkey");

            entity.ToTable("BLS_Hotels_List");

            entity.Property(e => e.Id)
                .HasComment("ID")
                .HasColumnName("ID");
            entity.Property(e => e.CreateDate).HasComment("创建时间");
            entity.Property(e => e.HotelCode)
                .HasMaxLength(255)
                .HasComment("酒店编号");
            entity.Property(e => e.HotelName)
                .HasMaxLength(255)
                .HasComment("酒店名称");
            entity.Property(e => e.Rooms).HasComment("房间数");
        });

        modelBuilder.Entity<DevMonitorlog>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("dev_monitorlog_pkey");

            entity.ToTable("dev_monitorlog");

            entity.HasIndex(e => e.CommandType, "CommandType");

            entity.HasIndex(e => e.CreateTimeToUnixTime, "CreateTime").IsDescending();

            entity.HasIndex(e => e.Id, "ID").IsUnique();

            entity.HasIndex(e => new { e.HotelCode, e.HostNumber, e.HostId, e.RoomNo }, "MAC");

            entity.HasIndex(e => e.Mac, "MM");

            entity.HasIndex(e => e.CreateTime, "T");

            entity.Property(e => e.Id).HasColumnName("ID");
            entity.Property(e => e.CommandType).HasMaxLength(128);
            entity.Property(e => e.CreateTime).HasColumnType("timestamp(6) without time zone");
            entity.Property(e => e.HostId).HasColumnName("HostID");
            entity.Property(e => e.HostNumber).HasMaxLength(64);
            entity.Property(e => e.HotelCode).HasMaxLength(64);
            entity.Property(e => e.HotelId).HasColumnName("HotelID");
            entity.Property(e => e.LanIp)
                .HasMaxLength(64)
                .HasColumnName("LanIP");
            entity.Property(e => e.Mac)
                .HasMaxLength(64)
                .HasColumnName("MAC");
            entity.Property(e => e.RoomNo).HasMaxLength(64);
            entity.Property(e => e.SendOrReceive).HasMaxLength(64);
            entity.Property(e => e.WwwIp)
                .HasMaxLength(64)
                .HasColumnName("WWW_IP");
            entity.Property(e => e.WwwPort).HasColumnName("WWW_Port");
        });

        modelBuilder.Entity<Excelgenerater>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("excelgenerater_pkey");

            entity.ToTable("excelgenerater");

            entity.Property(e => e.Id).HasColumnName("ID");
            entity.Property(e => e.CreateTime).HasColumnType("timestamp(6) without time zone");
            entity.Property(e => e.CreateTimeUnix).HasColumnName("CreateTime_UNIX");
        });

        modelBuilder.Entity<Qingao>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("Qingao_pkey");

            entity.ToTable("Qingao");

            entity.Property(e => e.Id).HasIdentityOptions(null, null, null, null, true, null);
            entity.Property(e => e.CurrentTime).HasColumnType("timestamp(6) without time zone");
            entity.Property(e => e.HotelCode).HasMaxLength(32);
            entity.Property(e => e.RoomNumber).HasMaxLength(64);
            entity.Property(e => e.TakeCardStatus).HasMaxLength(64);
        });

        modelBuilder.Entity<Recordhotel>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("recordhotel_pkey");

            entity.ToTable("recordhotel");

            entity.Property(e => e.Id).HasColumnName("ID");
            entity.Property(e => e.CreateTime).HasMaxLength(64);
            entity.Property(e => e.HotelId).HasColumnName("HotelID");
        });

        modelBuilder.Entity<SkyworthTvMonitorlog>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("skyworth_tv_monitorlog_pkey");

            entity.ToTable("skyworth_tv_monitorlog");

            entity.Property(e => e.Id).HasColumnName("ID");
            entity.Property(e => e.HotelCode).HasMaxLength(64);
            entity.Property(e => e.RequestId).HasMaxLength(64);
            entity.Property(e => e.RequestTime).HasColumnType("timestamp(6) without time zone");
            entity.Property(e => e.ResponseTime).HasColumnType("timestamp(6) without time zone");
            entity.Property(e => e.RoomNum).HasMaxLength(64);
            entity.Property(e => e.Step).HasMaxLength(16);
        });

        modelBuilder.Entity<StatisticsTotal>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("statistics_total_pkey");

            entity.ToTable("statistics_total");

            entity.Property(e => e.Id).HasColumnName("ID");
            entity.Property(e => e.HostNumber).HasMaxLength(64);
            entity.Property(e => e.HotelCode).HasMaxLength(64);
            entity.Property(e => e.Mac)
                .HasMaxLength(64)
                .HasColumnName("MAC");
            entity.Property(e => e.RxCount).HasColumnName("RX_Count");
            entity.Property(e => e.TxCount).HasColumnName("TX_Count");
            entity.Property(e => e.UpdateTime)
                .HasMaxLength(64)
                .HasColumnName("Update_Time");
        });

        modelBuilder.Entity<TclTvMonitorlog>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("tcl_tv_monitorlog_pkey");

            entity.ToTable("tcl_tv_monitorlog");

            entity.Property(e => e.Id).HasColumnName("ID");
            entity.Property(e => e.HotelCode).HasMaxLength(64);
            entity.Property(e => e.RequestId).HasMaxLength(64);
            entity.Property(e => e.RequestTime).HasColumnType("timestamp(6) without time zone");
            entity.Property(e => e.ResponseTime).HasColumnType("timestamp(6) without time zone");
            entity.Property(e => e.RoomNumber).HasMaxLength(64);
            entity.Property(e => e.Step)
                .HasMaxLength(16)
                .HasDefaultValueSql("NULL::character varying");
        });

        modelBuilder.Entity<WebapiMonitorlog>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("webapi_monitorlog_pkey");

            entity.ToTable("webapi_monitorlog");

            entity.HasIndex(e => e.MethodName, "MethodName");

            entity.HasIndex(e => new { e.InvokStartTime, e.InvokEndTime }, "Time");

            entity.Property(e => e.Id).HasColumnName("ID");
            entity.Property(e => e.HotelCode).HasMaxLength(64);
            entity.Property(e => e.InvokEndTime)
                .HasMaxLength(64)
                .HasColumnName("InvokEnd_Time");
            entity.Property(e => e.InvokStartTime)
                .HasMaxLength(64)
                .HasColumnName("InvokStart_Time");
            entity.Property(e => e.MethodName).HasMaxLength(128);
            entity.Property(e => e.RemoteIp)
                .HasMaxLength(64)
                .HasColumnName("RemoteIP");
            entity.Property(e => e.RoomNumber).HasMaxLength(64);
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
