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

#nullable disable

namespace MissionService.Infrastructure.Migrations
{
    [DbContext(typeof(MissionDbContext))]
    partial class MissionDbContextModelSnapshot : 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("MissionService.Domain.AggregatesModel.CheckInAggregate.CheckInDay", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<DateOnly>("Date")
                        .HasColumnType("date")
                        .HasColumnName("date");

                    b.Property<bool>("IsMilestone")
                        .HasColumnType("boolean")
                        .HasColumnName("is_milestone");

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

                    b.Property<int>("StreakOnDay")
                        .HasColumnType("integer")
                        .HasColumnName("streak_on_day");

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

                    b.HasKey("Id");

                    b.HasIndex("user_checkin_id", "Date")
                        .IsUnique();

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

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.CheckInAggregate.UserCheckIn", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<int>("CurrentStreak")
                        .HasColumnType("integer")
                        .HasColumnName("current_streak");

                    b.Property<DateOnly?>("LastCheckInDate")
                        .HasColumnType("date")
                        .HasColumnName("last_checkin_date");

                    b.Property<int>("LongestStreak")
                        .HasColumnType("integer")
                        .HasColumnName("longest_streak");

                    b.Property<int>("TotalCheckIns")
                        .HasColumnType("integer")
                        .HasColumnName("total_checkins");

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

                    b.HasKey("Id");

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

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

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.MissionAggregate.FrequencyType", b =>
                {
                    b.Property<int>("Id")
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.HasKey("Id");

                    b.ToTable("frequency_types", (string)null);

                    b.HasData(
                        new
                        {
                            Id = 1,
                            Name = "Once"
                        },
                        new
                        {
                            Id = 2,
                            Name = "Daily"
                        },
                        new
                        {
                            Id = 3,
                            Name = "Weekly"
                        },
                        new
                        {
                            Id = 4,
                            Name = "Unlimited"
                        });
                });

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.MissionAggregate.Mission", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<int>("Category")
                        .HasColumnType("integer")
                        .HasColumnName("category_id");

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

                    b.Property<string>("DescriptionEn")
                        .HasMaxLength(2000)
                        .HasColumnType("character varying(2000)")
                        .HasColumnName("description_en");

                    b.Property<string>("DescriptionVi")
                        .HasMaxLength(2000)
                        .HasColumnType("character varying(2000)")
                        .HasColumnName("description_vi");

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

                    b.Property<int>("Frequency")
                        .HasColumnType("integer")
                        .HasColumnName("frequency_id");

                    b.Property<int>("MaxCompletions")
                        .HasColumnType("integer")
                        .HasColumnName("max_completions");

                    b.Property<int>("Priority")
                        .HasColumnType("integer")
                        .HasColumnName("priority");

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("start_date");

                    b.Property<int>("Status")
                        .HasColumnType("integer")
                        .HasColumnName("status_id");

                    b.Property<string>("TitleEn")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)")
                        .HasColumnName("title_en");

                    b.Property<string>("TitleVi")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)")
                        .HasColumnName("title_vi");

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

                    b.HasKey("Id");

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

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

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.MissionAggregate.MissionCategory", b =>
                {
                    b.Property<int>("Id")
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.HasKey("Id");

                    b.ToTable("mission_categories", (string)null);

                    b.HasData(
                        new
                        {
                            Id = 1,
                            Name = "Daily"
                        },
                        new
                        {
                            Id = 2,
                            Name = "Weekly"
                        },
                        new
                        {
                            Id = 3,
                            Name = "Special"
                        },
                        new
                        {
                            Id = 4,
                            Name = "Onboarding"
                        },
                        new
                        {
                            Id = 5,
                            Name = "Event"
                        });
                });

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.MissionAggregate.MissionRule", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<string>("Metadata")
                        .HasColumnType("jsonb")
                        .HasColumnName("metadata");

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

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

                    b.Property<string>("Value")
                        .IsRequired()
                        .HasMaxLength(500)
                        .HasColumnType("character varying(500)")
                        .HasColumnName("value");

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

                    b.HasKey("Id");

                    b.HasIndex("mission_id");

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

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.MissionAggregate.MissionStatus", b =>
                {
                    b.Property<int>("Id")
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.HasKey("Id");

                    b.ToTable("mission_statuses", (string)null);

                    b.HasData(
                        new
                        {
                            Id = 1,
                            Name = "Draft"
                        },
                        new
                        {
                            Id = 2,
                            Name = "Active"
                        },
                        new
                        {
                            Id = 3,
                            Name = "Paused"
                        },
                        new
                        {
                            Id = 4,
                            Name = "Expired"
                        },
                        new
                        {
                            Id = 5,
                            Name = "Archived"
                        });
                });

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.MissionAggregate.MissionType", b =>
                {
                    b.Property<int>("Id")
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.HasKey("Id");

                    b.ToTable("mission_types", (string)null);

                    b.HasData(
                        new
                        {
                            Id = 1,
                            Name = "Video"
                        },
                        new
                        {
                            Id = 2,
                            Name = "Click"
                        },
                        new
                        {
                            Id = 3,
                            Name = "Upload"
                        },
                        new
                        {
                            Id = 4,
                            Name = "Invite"
                        },
                        new
                        {
                            Id = 5,
                            Name = "CheckIn"
                        },
                        new
                        {
                            Id = 6,
                            Name = "Social"
                        });
                });

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.RewardAggregate.UserReward", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid")
                        .HasColumnName("id");

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

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

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

                    b.Property<Guid>("SourceId")
                        .HasColumnType("uuid")
                        .HasColumnName("source_id");

                    b.Property<int>("Status")
                        .HasColumnType("integer")
                        .HasColumnName("status");

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

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

                    b.HasKey("Id");

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

                    b.HasIndex("UserId");

                    b.HasIndex("Status", "ExpiresAt");

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

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.TaskAggregate.TaskStatus", b =>
                {
                    b.Property<int>("Id")
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.HasKey("Id");

                    b.ToTable("task_statuses", (string)null);

                    b.HasData(
                        new
                        {
                            Id = 1,
                            Name = "Pending"
                        },
                        new
                        {
                            Id = 2,
                            Name = "InProgress"
                        },
                        new
                        {
                            Id = 3,
                            Name = "PendingVerification"
                        },
                        new
                        {
                            Id = 4,
                            Name = "Completed"
                        },
                        new
                        {
                            Id = 5,
                            Name = "Rejected"
                        },
                        new
                        {
                            Id = 6,
                            Name = "Cancelled"
                        },
                        new
                        {
                            Id = 7,
                            Name = "Expired"
                        });
                });

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.TaskAggregate.UserTask", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid")
                        .HasColumnName("id");

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

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

                    b.Property<Guid>("MissionId")
                        .HasColumnType("uuid")
                        .HasColumnName("mission_id");

                    b.Property<bool>("RewardClaimed")
                        .HasColumnType("boolean")
                        .HasColumnName("reward_claimed");

                    b.Property<DateTime>("StartedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("started_at");

                    b.Property<int>("Status")
                        .HasColumnType("integer")
                        .HasColumnName("status_id");

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

                    b.HasKey("Id");

                    b.HasIndex("MissionId");

                    b.HasIndex("UserId");

                    b.HasIndex("UserId", "MissionId");

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

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.CheckInAggregate.CheckInDay", b =>
                {
                    b.HasOne("MissionService.Domain.AggregatesModel.CheckInAggregate.UserCheckIn", null)
                        .WithMany("CheckInDays")
                        .HasForeignKey("user_checkin_id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.MissionAggregate.Mission", b =>
                {
                    b.OwnsOne("MissionService.Domain.AggregatesModel.MissionAggregate.MissionReward", "Reward", b1 =>
                        {
                            b1.Property<Guid>("MissionId")
                                .HasColumnType("uuid");

                            b1.Property<string>("BadgeId")
                                .HasMaxLength(50)
                                .HasColumnType("character varying(50)")
                                .HasColumnName("reward_badge_id");

                            b1.Property<int>("ExperiencePoints")
                                .HasColumnType("integer")
                                .HasColumnName("reward_xp");

                            b1.Property<decimal>("MiningBoostPercent")
                                .HasPrecision(5, 2)
                                .HasColumnType("numeric(5,2)")
                                .HasColumnName("reward_mining_boost");

                            b1.Property<decimal>("Points")
                                .HasPrecision(18, 2)
                                .HasColumnType("numeric(18,2)")
                                .HasColumnName("reward_points");

                            b1.HasKey("MissionId");

                            b1.ToTable("missions");

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

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

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.MissionAggregate.MissionRule", b =>
                {
                    b.HasOne("MissionService.Domain.AggregatesModel.MissionAggregate.Mission", null)
                        .WithMany("Rules")
                        .HasForeignKey("mission_id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.RewardAggregate.UserReward", b =>
                {
                    b.OwnsOne("MissionService.Domain.AggregatesModel.RewardAggregate.RewardAmount", "Amount", b1 =>
                        {
                            b1.Property<Guid>("UserRewardId")
                                .HasColumnType("uuid");

                            b1.Property<decimal>("BonusPoints")
                                .HasPrecision(18, 2)
                                .HasColumnType("numeric(18,2)")
                                .HasColumnName("bonus_points");

                            b1.Property<string>("Currency")
                                .IsRequired()
                                .ValueGeneratedOnAdd()
                                .HasMaxLength(10)
                                .HasColumnType("character varying(10)")
                                .HasDefaultValue("MP")
                                .HasColumnName("currency");

                            b1.Property<decimal>("Points")
                                .HasPrecision(18, 2)
                                .HasColumnType("numeric(18,2)")
                                .HasColumnName("points");

                            b1.HasKey("UserRewardId");

                            b1.ToTable("user_rewards");

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

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

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.TaskAggregate.UserTask", b =>
                {
                    b.OwnsOne("MissionService.Domain.AggregatesModel.TaskAggregate.TaskEvidence", "Evidence", b1 =>
                        {
                            b1.Property<Guid>("UserTaskId")
                                .HasColumnType("uuid");

                            b1.Property<DateTime>("CapturedAt")
                                .HasColumnType("timestamp with time zone")
                                .HasColumnName("evidence_captured_at");

                            b1.Property<string>("Data")
                                .IsRequired()
                                .HasMaxLength(4000)
                                .HasColumnType("character varying(4000)")
                                .HasColumnName("evidence_data");

                            b1.Property<string>("ScreenshotUrl")
                                .HasMaxLength(500)
                                .HasColumnType("character varying(500)")
                                .HasColumnName("evidence_screenshot_url");

                            b1.Property<int>("Type")
                                .HasColumnType("integer")
                                .HasColumnName("evidence_type");

                            b1.Property<string>("VideoUrl")
                                .HasMaxLength(500)
                                .HasColumnType("character varying(500)")
                                .HasColumnName("evidence_video_url");

                            b1.HasKey("UserTaskId");

                            b1.ToTable("user_tasks");

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

                    b.OwnsOne("MissionService.Domain.AggregatesModel.TaskAggregate.TaskProgress", "Progress", b1 =>
                        {
                            b1.Property<Guid>("UserTaskId")
                                .HasColumnType("uuid");

                            b1.Property<int>("CurrentValue")
                                .HasColumnType("integer")
                                .HasColumnName("progress_current");

                            b1.Property<DateTime>("LastUpdated")
                                .HasColumnType("timestamp with time zone")
                                .HasColumnName("progress_updated_at");

                            b1.Property<int>("TargetValue")
                                .HasColumnType("integer")
                                .HasColumnName("progress_target");

                            b1.HasKey("UserTaskId");

                            b1.ToTable("user_tasks");

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

                    b.OwnsOne("MissionService.Domain.AggregatesModel.TaskAggregate.VerificationResult", "Verification", b1 =>
                        {
                            b1.Property<Guid>("UserTaskId")
                                .HasColumnType("uuid");

                            b1.Property<string>("FailureReason")
                                .HasMaxLength(500)
                                .HasColumnType("character varying(500)")
                                .HasColumnName("verification_failure_reason");

                            b1.Property<bool>("IsValid")
                                .HasColumnType("boolean")
                                .HasColumnName("verification_valid");

                            b1.Property<int>("Method")
                                .HasColumnType("integer")
                                .HasColumnName("verification_method");

                            b1.Property<DateTime>("VerifiedAt")
                                .HasColumnType("timestamp with time zone")
                                .HasColumnName("verification_at");

                            b1.Property<Guid?>("VerifiedBy")
                                .HasColumnType("uuid")
                                .HasColumnName("verification_by");

                            b1.HasKey("UserTaskId");

                            b1.ToTable("user_tasks");

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

                    b.Navigation("Evidence");

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

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

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.CheckInAggregate.UserCheckIn", b =>
                {
                    b.Navigation("CheckInDays");
                });

            modelBuilder.Entity("MissionService.Domain.AggregatesModel.MissionAggregate.Mission", b =>
                {
                    b.Navigation("Rules");
                });
#pragma warning restore 612, 618
        }
    }
}
