// <auto-generated />
using System;
using Koronba.Core.Persistence.DatabaseContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace Koronba.Core.Migrations
{
    [DbContext(typeof(KoronbaDbContext))]
    [Migration("20240125091833_Initial")]
    partial class Initial
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder.HasAnnotation("ProductVersion", "8.0.1");

            modelBuilder.Entity("FlashTag", b =>
                {
                    b.Property<int>("FlashesId")
                        .HasColumnType("INTEGER");

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

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

                    b.HasIndex("TagsId");

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

            modelBuilder.Entity("Koronba.Core.Models.Flash", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("TEXT");

                    b.Property<string>("Hash")
                        .IsRequired()
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("LastSeenAt")
                        .HasColumnType("TEXT");

                    b.HasKey("Id");

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("FlashTag", b =>
                {
                    b.HasOne("Koronba.Core.Models.Flash", null)
                        .WithMany()
                        .HasForeignKey("FlashesId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("Koronba.Core.Models.Flash", b =>
                {
                    b.OwnsOne("Koronba.Core.Models.FlashMeta", "Metadata", b1 =>
                        {
                            b1.Property<int>("FlashId")
                                .HasColumnType("INTEGER");

                            b1.Property<int>("FileSize")
                                .HasColumnType("INTEGER");

                            b1.Property<Guid>("Id")
                                .HasColumnType("TEXT");

                            b1.HasKey("FlashId");

                            b1.ToTable("Flashes");

                            b1.WithOwner()
                                .HasForeignKey("FlashId");
                        });

                    b.OwnsMany("Koronba.Core.Models.FlashName", "KnownNames", b1 =>
                        {
                            b1.Property<int>("FlashId")
                                .HasColumnType("INTEGER");

                            b1.Property<Guid>("Id")
                                .ValueGeneratedOnAdd()
                                .HasColumnType("TEXT");

                            b1.Property<string>("Name")
                                .IsRequired()
                                .HasColumnType("TEXT");

                            b1.Property<int>("Seen")
                                .HasColumnType("INTEGER");

                            b1.HasKey("FlashId", "Id");

                            b1.ToTable("FlashName");

                            b1.WithOwner()
                                .HasForeignKey("FlashId");
                        });

                    b.Navigation("KnownNames");

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