// <auto-generated />
using System;
using BUSNOW.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace BUSNOW.Migrations
{
    [DbContext(typeof(AppDbContext))]
    [Migration("20251103131013_correctTheOneToOneRelationShip")]
    partial class correctTheOneToOneRelationShip
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "9.0.10")
                .HasAnnotation("Relational:MaxIdentifierLength", 64);

            MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);

            modelBuilder.Entity("BUSNOW.Models.Bus", b =>
                {
                    b.Property<int>("BusId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("BusId"));

                    b.Property<int>("LineId")
                        .HasColumnType("int");

                    b.Property<string>("Plate")
                        .IsRequired()
                        .HasColumnType("longtext");

                    b.HasKey("BusId");

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

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

            modelBuilder.Entity("BUSNOW.Models.Line", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));

                    b.Property<int>("DriverId")
                        .HasColumnType("int");

                    b.Property<int>("SupervisorId")
                        .HasColumnType("int");

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("BUSNOW.Models.Passenger", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));

                    b.Property<bool>("IsActive")
                        .HasColumnType("tinyint(1)");

                    b.Property<int>("LineId")
                        .HasColumnType("int");

                    b.Property<DateTime>("RegisterDate")
                        .HasColumnType("datetime(6)");

                    b.HasKey("Id");

                    b.HasIndex("LineId");

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

            modelBuilder.Entity("BUSNOW.Models.Stop", b =>
                {
                    b.Property<int>("StopId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("StopId"));

                    b.Property<int>("LineId")
                        .HasColumnType("int");

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

                    b.HasKey("StopId");

                    b.HasIndex("LineId");

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

            modelBuilder.Entity("BUSNOW.Models.Bus", b =>
                {
                    b.HasOne("BUSNOW.Models.Line", "Line")
                        .WithOne("Bus")
                        .HasForeignKey("BUSNOW.Models.Bus", "LineId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("BUSNOW.Models.Passenger", b =>
                {
                    b.HasOne("BUSNOW.Models.Line", "Line")
                        .WithMany("Passengers")
                        .HasForeignKey("LineId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("BUSNOW.Models.Stop", b =>
                {
                    b.HasOne("BUSNOW.Models.Line", "Line")
                        .WithMany("Stops")
                        .HasForeignKey("LineId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("BUSNOW.Models.Line", b =>
                {
                    b.Navigation("Bus")
                        .IsRequired();

                    b.Navigation("Passengers");

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