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

#nullable disable

namespace Lactose.Migrations
{
    [DbContext(typeof(LactoseDbContext))]
    [Migration("20241217213312_Initial")]
    partial class Initial
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "9.0.0")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("AlbumAsset", b =>
                {
                    b.Property<Guid>("AlbumsId")
                        .HasColumnType("uuid");

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

                    b.HasKey("AlbumsId", "AssetsId");

                    b.HasIndex("AssetsId");

                    b.ToTable("AlbumAsset");
                });

            modelBuilder.Entity("AssetTag", b =>
                {
                    b.Property<Guid>("AssetsId")
                        .HasColumnType("uuid");

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

                    b.HasKey("AssetsId", "TagsId");

                    b.HasIndex("TagsId");

                    b.ToTable("AssetTag");
                });

            modelBuilder.Entity("Lactose.Models.Album", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("VARCHAR(255)");

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

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

                    b.HasKey("Id");

                    b.HasIndex("PersonOwnerId");

                    b.HasIndex("UserOwnerId");

                    b.ToTable("Albums");
                });

            modelBuilder.Entity("Lactose.Models.Asset", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

                    b.Property<float?>("Duration")
                        .HasColumnType("real");

                    b.Property<long>("FileSize")
                        .HasColumnType("bigint");

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

                    b.Property<float?>("FrameRate")
                        .HasColumnType("real");

                    b.Property<byte[]>("Hash")
                        .IsRequired()
                        .HasColumnType("BLOB(128)");

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

                    b.Property<string>("MimeType")
                        .IsRequired()
                        .HasColumnType("VARCHAR(255)");

                    b.Property<string>("OriginalFilename")
                        .IsRequired()
                        .HasColumnType("VARCHAR(255)");

                    b.Property<string>("OriginalPath")
                        .IsRequired()
                        .HasColumnType("VARCHAR(2048)");

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

                    b.Property<string>("PreviewPath")
                        .IsRequired()
                        .HasColumnType("VARCHAR(2048)");

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

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

                    b.Property<string>("ThumbnailPath")
                        .IsRequired()
                        .HasColumnType("VARCHAR(2048)");

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

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

                    b.HasKey("Id");

                    b.HasIndex("FolderId");

                    b.HasIndex("OwnerId");

                    b.ToTable("Assets");
                });

            modelBuilder.Entity("Lactose.Models.Face", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("AssetId");

                    b.HasIndex("PersonId");

                    b.ToTable("Faces");
                });

            modelBuilder.Entity("Lactose.Models.Folder", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

                    b.Property<string>("BasePath")
                        .IsRequired()
                        .HasColumnType("VARCHAR(2048)");

                    b.HasKey("Id");

                    b.ToTable("Folders");
                });

            modelBuilder.Entity("Lactose.Models.Person", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("VARCHAR(255)");

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

                    b.HasKey("Id");

                    b.ToTable("People");
                });

            modelBuilder.Entity("Lactose.Models.Settings", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

                    b.HasKey("Id");

                    b.ToTable("Settings");
                });

            modelBuilder.Entity("Lactose.Models.Tag", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("VARCHAR(255)");

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

                    b.HasKey("Id");

                    b.HasIndex("ParentId");

                    b.ToTable("Tags");
                });

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

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

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

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

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

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

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

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

                    b.Property<string>("Password")
                        .IsRequired()
                        .HasColumnType("VARCHAR(255)");

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

                    b.Property<string>("Username")
                        .IsRequired()
                        .HasColumnType("VARCHAR(64)");

                    b.HasKey("Id");

                    b.HasIndex("AssetId");

                    b.ToTable("Users");
                });

            modelBuilder.Entity("AlbumAsset", b =>
                {
                    b.HasOne("Lactose.Models.Album", null)
                        .WithMany()
                        .HasForeignKey("AlbumsId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Lactose.Models.Asset", null)
                        .WithMany()
                        .HasForeignKey("AssetsId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("AssetTag", b =>
                {
                    b.HasOne("Lactose.Models.Asset", null)
                        .WithMany()
                        .HasForeignKey("AssetsId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Lactose.Models.Tag", null)
                        .WithMany()
                        .HasForeignKey("TagsId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Lactose.Models.Album", b =>
                {
                    b.HasOne("Lactose.Models.Person", "PersonOwner")
                        .WithMany("Albums")
                        .HasForeignKey("PersonOwnerId");

                    b.HasOne("Lactose.Models.User", "UserOwner")
                        .WithMany("OwnedAlbums")
                        .HasForeignKey("UserOwnerId");

                    b.Navigation("PersonOwner");

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

            modelBuilder.Entity("Lactose.Models.Asset", b =>
                {
                    b.HasOne("Lactose.Models.Folder", "Folder")
                        .WithMany("Assets")
                        .HasForeignKey("FolderId");

                    b.HasOne("Lactose.Models.User", "Owner")
                        .WithMany("OwnedAssets")
                        .HasForeignKey("OwnerId");

                    b.Navigation("Folder");

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

            modelBuilder.Entity("Lactose.Models.Face", b =>
                {
                    b.HasOne("Lactose.Models.Asset", "Asset")
                        .WithMany("Faces")
                        .HasForeignKey("AssetId");

                    b.HasOne("Lactose.Models.Person", "Person")
                        .WithMany("Faces")
                        .HasForeignKey("PersonId");

                    b.Navigation("Asset");

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

            modelBuilder.Entity("Lactose.Models.Tag", b =>
                {
                    b.HasOne("Lactose.Models.Tag", "Parent")
                        .WithMany()
                        .HasForeignKey("ParentId");

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

            modelBuilder.Entity("Lactose.Models.User", b =>
                {
                    b.HasOne("Lactose.Models.Asset", null)
                        .WithMany("SharedWith")
                        .HasForeignKey("AssetId");
                });

            modelBuilder.Entity("Lactose.Models.Asset", b =>
                {
                    b.Navigation("Faces");

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

            modelBuilder.Entity("Lactose.Models.Folder", b =>
                {
                    b.Navigation("Assets");
                });

            modelBuilder.Entity("Lactose.Models.Person", b =>
                {
                    b.Navigation("Albums");

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

            modelBuilder.Entity("Lactose.Models.User", b =>
                {
                    b.Navigation("OwnedAlbums");

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