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

#nullable disable

namespace MiningService.Infrastructure.Migrations
{
    [DbContext(typeof(MiningServiceContext))]
    partial class MiningServiceContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "10.0.2")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("MiningService.Domain.AggregatesModel.CircleAggregate.Circle", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<decimal>("BonusMultiplier")
                        .HasPrecision(5, 4)
                        .HasColumnType("numeric(5,4)");

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

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

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

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<decimal>("TrustScore")
                        .HasPrecision(5, 2)
                        .HasColumnType("numeric(5,2)");

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

                    b.HasKey("Id");

                    b.HasIndex("OwnerId")
                        .HasDatabaseName("IX_Circles_OwnerId");

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

            modelBuilder.Entity("MiningService.Domain.AggregatesModel.CircleAggregate.CircleMember", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("MinerId")
                        .HasDatabaseName("IX_CircleMembers_MinerId");

                    b.HasIndex("CircleId", "MinerId")
                        .IsUnique()
                        .HasDatabaseName("IX_CircleMembers_CircleId_MinerId");

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

            modelBuilder.Entity("MiningService.Domain.AggregatesModel.MinerAggregate.Miner", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

                    b.Property<string>("ReferralCode")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("character varying(10)");

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

                    b.Property<string>("Role")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<byte[]>("RowVersion")
                        .IsConcurrencyToken()
                        .IsRequired()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("bytea");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<decimal>("TotalMinedPoints")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

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

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

                    b.HasKey("Id");

                    b.HasIndex("ReferralCode")
                        .IsUnique()
                        .HasDatabaseName("IX_Miners_ReferralCode");

                    b.HasIndex("UserId")
                        .IsUnique()
                        .HasDatabaseName("IX_Miners_UserId");

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

            modelBuilder.Entity("MiningService.Domain.AggregatesModel.MinerAggregate.MiningHistory", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

                    b.Property<decimal>("HourlyRateSnapshot")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

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

                    b.Property<decimal>("PointsEarned")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

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

                    b.Property<string>("Source")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

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

                    b.HasKey("Id");

                    b.HasIndex("MinerId", "EarnedAt")
                        .HasDatabaseName("IX_MiningHistories_MinerId_EarnedAt");

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

            modelBuilder.Entity("MiningService.Domain.AggregatesModel.ReferralAggregate.Referral", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

                    b.Property<decimal>("BonusRate")
                        .HasPrecision(5, 4)
                        .HasColumnType("numeric(5,4)");

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

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

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

                    b.Property<string>("ReferralCode")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("character varying(10)");

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

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

                    b.HasKey("Id");

                    b.HasIndex("ReferredId")
                        .IsUnique()
                        .HasDatabaseName("IX_Referrals_ReferredId");

                    b.HasIndex("ReferrerId")
                        .HasDatabaseName("IX_Referrals_ReferrerId");

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

            modelBuilder.Entity("MiningService.Domain.AggregatesModel.CircleAggregate.CircleMember", b =>
                {
                    b.HasOne("MiningService.Domain.AggregatesModel.CircleAggregate.Circle", null)
                        .WithMany("Members")
                        .HasForeignKey("CircleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("MiningService.Domain.AggregatesModel.MinerAggregate.Miner", b =>
                {
                    b.OwnsOne("MiningService.Domain.AggregatesModel.MinerAggregate.MiningRate", "CurrentRate", b1 =>
                        {
                            b1.Property<Guid>("MinerId")
                                .HasColumnType("uuid");

                            b1.Property<decimal>("BaseRate")
                                .HasPrecision(18, 4)
                                .HasColumnType("numeric(18,4)");

                            b1.Property<decimal>("CircleBonus")
                                .HasPrecision(5, 4)
                                .HasColumnType("numeric(5,4)");

                            b1.Property<decimal>("ReferralBonus")
                                .HasPrecision(5, 4)
                                .HasColumnType("numeric(5,4)");

                            b1.Property<decimal>("RoleBonus")
                                .HasPrecision(5, 4)
                                .HasColumnType("numeric(5,4)");

                            b1.Property<decimal>("StreakBonus")
                                .HasPrecision(5, 4)
                                .HasColumnType("numeric(5,4)");

                            b1.HasKey("MinerId");

                            b1.ToTable("Miners");

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

                    b.OwnsOne("MiningService.Domain.AggregatesModel.MinerAggregate.MiningSession", "ActiveSession", b1 =>
                        {
                            b1.Property<Guid>("MinerId")
                                .HasColumnType("uuid");

                            b1.Property<decimal>("AccumulatedPoints")
                                .HasPrecision(18, 4)
                                .HasColumnType("numeric(18,4)");

                            b1.Property<DateTime>("EndTime")
                                .HasColumnType("timestamp with time zone");

                            b1.Property<decimal>("HourlyRate")
                                .HasPrecision(18, 4)
                                .HasColumnType("numeric(18,4)");

                            b1.Property<Guid>("SessionId")
                                .HasColumnType("uuid");

                            b1.Property<DateTime>("StartTime")
                                .HasColumnType("timestamp with time zone");

                            b1.Property<string>("Status")
                                .IsRequired()
                                .HasMaxLength(20)
                                .HasColumnType("character varying(20)");

                            b1.HasKey("MinerId");

                            b1.ToTable("Miners");

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

                    b.OwnsOne("MiningService.Domain.AggregatesModel.MinerAggregate.MiningStreak", "Streak", b1 =>
                        {
                            b1.Property<Guid>("MinerId")
                                .HasColumnType("uuid");

                            b1.Property<int>("CurrentStreak")
                                .HasColumnType("integer");

                            b1.Property<int>("FreezeTokens")
                                .HasColumnType("integer");

                            b1.Property<bool>("IsGracePeriod")
                                .HasColumnType("boolean");

                            b1.Property<DateTime>("LastMiningDate")
                                .HasColumnType("timestamp with time zone");

                            b1.Property<int>("LongestStreak")
                                .HasColumnType("integer");

                            b1.HasKey("MinerId");

                            b1.ToTable("Miners");

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

                    b.Navigation("ActiveSession");

                    b.Navigation("CurrentRate")
                        .IsRequired();

                    b.Navigation("Streak")
                        .IsRequired();
                });

            modelBuilder.Entity("MiningService.Domain.AggregatesModel.MinerAggregate.MiningHistory", b =>
                {
                    b.HasOne("MiningService.Domain.AggregatesModel.MinerAggregate.Miner", null)
                        .WithMany("MiningHistories")
                        .HasForeignKey("MinerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("MiningService.Domain.AggregatesModel.CircleAggregate.Circle", b =>
                {
                    b.Navigation("Members");
                });

            modelBuilder.Entity("MiningService.Domain.AggregatesModel.MinerAggregate.Miner", b =>
                {
                    b.Navigation("MiningHistories");
                });
#pragma warning restore 612, 618
        }
    }
}
