// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using VoidCat.Services;

#nullable disable

namespace VoidCat.Migrations
{
    [DbContext(typeof(VoidContext))]
    [Migration("20230529211453_AddFileId")]
    partial class AddFileId
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.5")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("VoidCat.Database.ApiKey", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<DateTime>("Created")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTime>("Expiry")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Token")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("ApiKey", (string)null);
                });

            modelBuilder.Entity("VoidCat.Database.EmailVerification", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<Guid>("Code")
                        .HasColumnType("uuid");

                    b.Property<DateTime>("Expires")
                        .HasColumnType("timestamp with time zone");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("EmailVerification", (string)null);
                });

            modelBuilder.Entity("VoidCat.Database.File", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<string>("Digest")
                        .HasColumnType("text");

                    b.Property<Guid>("EditSecret")
                        .HasColumnType("uuid");

                    b.Property<string>("EncryptionParams")
                        .HasColumnType("text");

                    b.Property<DateTime?>("Expires")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("MagnetLink")
                        .HasColumnType("text");

                    b.Property<string>("MimeType")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("text")
                        .HasDefaultValue("application/octet-stream");

                    b.Property<string>("Name")
                        .HasColumnType("text");

                    b.Property<decimal>("Size")
                        .HasColumnType("numeric(20,0)");

                    b.Property<string>("Storage")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("text")
                        .HasDefaultValue("local-disk");

                    b.Property<DateTime>("Uploaded")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("Id");

                    b.HasIndex("Uploaded");

                    b.ToTable("Files", (string)null);
                });

            modelBuilder.Entity("VoidCat.Database.Paywall", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<decimal>("Amount")
                        .HasColumnType("numeric");

                    b.Property<byte>("Currency")
                        .HasColumnType("smallint");

                    b.Property<Guid>("FileId")
                        .HasColumnType("uuid");

                    b.Property<bool>("Required")
                        .HasColumnType("boolean");

                    b.Property<int>("Service")
                        .HasColumnType("integer");

                    b.Property<string>("Upstream")
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.HasIndex("FileId")
                        .IsUnique();

                    b.ToTable("Payment", (string)null);
                });

            modelBuilder.Entity("VoidCat.Database.PaywallOrder", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<decimal>("Amount")
                        .HasColumnType("numeric");

                    b.Property<byte>("Currency")
                        .HasColumnType("smallint");

                    b.Property<Guid>("FileId")
                        .HasColumnType("uuid");

                    b.Property<int>("Service")
                        .HasColumnType("integer");

                    b.Property<byte>("Status")
                        .HasColumnType("smallint");

                    b.HasKey("Id");

                    b.HasIndex("FileId");

                    b.HasIndex("Status");

                    b.ToTable("PaymentOrder", (string)null);
                });

            modelBuilder.Entity("VoidCat.Database.PaywallOrderLightning", b =>
                {
                    b.Property<Guid>("OrderId")
                        .HasColumnType("uuid");

                    b.Property<DateTime>("Expire")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Invoice")
                        .IsRequired()
                        .HasColumnType("text");

                    b.HasKey("OrderId");

                    b.ToTable("PaymentOrderLightning", (string)null);
                });

            modelBuilder.Entity("VoidCat.Database.User", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<int>("AuthType")
                        .HasColumnType("integer");

                    b.Property<string>("Avatar")
                        .HasColumnType("text");

                    b.Property<DateTime>("Created")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("DisplayName")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("text")
                        .HasDefaultValue("void user");

                    b.Property<string>("Email")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("Flags")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("LastLogin")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Password")
                        .HasColumnType("text");

                    b.Property<string>("Storage")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("text")
                        .HasDefaultValue("local-disk");

                    b.HasKey("Id");

                    b.HasIndex("Email");

                    b.ToTable("Users", (string)null);
                });

            modelBuilder.Entity("VoidCat.Database.UserAuthToken", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<string>("AccessToken")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<DateTime>("Expires")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("IdToken")
                        .HasColumnType("text");

                    b.Property<string>("Provider")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("RefreshToken")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("Scope")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("TokenType")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("UsersAuthToken", (string)null);
                });

            modelBuilder.Entity("VoidCat.Database.UserFile", b =>
                {
                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("FileId")
                        .HasColumnType("uuid");

                    b.HasKey("UserId", "FileId");

                    b.HasIndex("FileId")
                        .IsUnique();

                    b.ToTable("UserFiles", (string)null);
                });

            modelBuilder.Entity("VoidCat.Database.UserRole", b =>
                {
                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid");

                    b.Property<string>("Role")
                        .HasColumnType("text");

                    b.HasKey("UserId", "Role");

                    b.ToTable("UserRoles", (string)null);
                });

            modelBuilder.Entity("VoidCat.Database.VirusScanResult", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<Guid>("FileId")
                        .HasColumnType("uuid");

                    b.Property<string>("Names")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<DateTime>("ScanTime")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Scanner")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<decimal>("Score")
                        .HasColumnType("numeric");

                    b.HasKey("Id");

                    b.HasIndex("FileId");

                    b.ToTable("VirusScanResult", (string)null);
                });

            modelBuilder.Entity("VoidCat.Database.ApiKey", b =>
                {
                    b.HasOne("VoidCat.Database.User", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("VoidCat.Database.EmailVerification", b =>
                {
                    b.HasOne("VoidCat.Database.User", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("VoidCat.Database.Paywall", b =>
                {
                    b.HasOne("VoidCat.Database.File", "File")
                        .WithOne("Paywall")
                        .HasForeignKey("VoidCat.Database.Paywall", "FileId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("File");
                });

            modelBuilder.Entity("VoidCat.Database.PaywallOrder", b =>
                {
                    b.HasOne("VoidCat.Database.File", "File")
                        .WithMany()
                        .HasForeignKey("FileId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("File");
                });

            modelBuilder.Entity("VoidCat.Database.PaywallOrderLightning", b =>
                {
                    b.HasOne("VoidCat.Database.PaywallOrder", "Order")
                        .WithOne("OrderLightning")
                        .HasForeignKey("VoidCat.Database.PaywallOrderLightning", "OrderId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Order");
                });

            modelBuilder.Entity("VoidCat.Database.UserAuthToken", b =>
                {
                    b.HasOne("VoidCat.Database.User", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("VoidCat.Database.UserFile", b =>
                {
                    b.HasOne("VoidCat.Database.File", "File")
                        .WithOne()
                        .HasForeignKey("VoidCat.Database.UserFile", "FileId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("VoidCat.Database.User", "User")
                        .WithMany("UserFiles")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("File");

                    b.Navigation("User");
                });

            modelBuilder.Entity("VoidCat.Database.UserRole", b =>
                {
                    b.HasOne("VoidCat.Database.User", "User")
                        .WithMany("Roles")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("VoidCat.Database.VirusScanResult", b =>
                {
                    b.HasOne("VoidCat.Database.File", "File")
                        .WithMany()
                        .HasForeignKey("FileId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("File");
                });

            modelBuilder.Entity("VoidCat.Database.File", b =>
                {
                    b.Navigation("Paywall");
                });

            modelBuilder.Entity("VoidCat.Database.PaywallOrder", b =>
                {
                    b.Navigation("OrderLightning");
                });

            modelBuilder.Entity("VoidCat.Database.User", b =>
                {
                    b.Navigation("Roles");

                    b.Navigation("UserFiles");
                });
#pragma warning restore 612, 618
        }
    }
}
