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

#nullable disable

namespace ClaudeDo.Data.Migrations
{
    [DbContext(typeof(ClaudeDoDbContext))]
    partial class ClaudeDoDbContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder.HasAnnotation("ProductVersion", "8.0.11");

            modelBuilder.Entity("ClaudeDo.Data.Models.AppSettingsEntity", b =>
                {
                    b.Property<int>("Id")
                        .HasColumnType("INTEGER")
                        .HasColumnName("id");

                    b.Property<string>("CentralWorktreeRoot")
                        .HasColumnType("TEXT")
                        .HasColumnName("central_worktree_root");

                    b.Property<string>("DefaultClaudeInstructions")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT")
                        .HasDefaultValue("")
                        .HasColumnName("default_claude_instructions");

                    b.Property<int>("DefaultMaxTurns")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER")
                        .HasDefaultValue(30)
                        .HasColumnName("default_max_turns");

                    b.Property<string>("DefaultModel")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT")
                        .HasDefaultValue("sonnet")
                        .HasColumnName("default_model");

                    b.Property<string>("DefaultPermissionMode")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT")
                        .HasDefaultValue("bypassPermissions")
                        .HasColumnName("default_permission_mode");

                    b.Property<int>("WorktreeAutoCleanupDays")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER")
                        .HasDefaultValue(7)
                        .HasColumnName("worktree_auto_cleanup_days");

                    b.Property<bool>("WorktreeAutoCleanupEnabled")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER")
                        .HasDefaultValue(false)
                        .HasColumnName("worktree_auto_cleanup_enabled");

                    b.Property<string>("WorktreeStrategy")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT")
                        .HasDefaultValue("sibling")
                        .HasColumnName("worktree_strategy");

                    b.HasKey("Id");

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

                    b.HasData(
                        new
                        {
                            Id = 1,
                            DefaultClaudeInstructions = "",
                            DefaultMaxTurns = 30,
                            DefaultModel = "sonnet",
                            DefaultPermissionMode = "bypassPermissions",
                            WorktreeAutoCleanupDays = 7,
                            WorktreeAutoCleanupEnabled = false,
                            WorktreeStrategy = "sibling"
                        });
                });

            modelBuilder.Entity("ClaudeDo.Data.Models.ListConfigEntity", b =>
                {
                    b.Property<string>("ListId")
                        .HasColumnType("TEXT")
                        .HasColumnName("list_id");

                    b.Property<string>("AgentPath")
                        .HasColumnType("TEXT")
                        .HasColumnName("agent_path");

                    b.Property<string>("Model")
                        .HasColumnType("TEXT")
                        .HasColumnName("model");

                    b.Property<string>("SystemPrompt")
                        .HasColumnType("TEXT")
                        .HasColumnName("system_prompt");

                    b.HasKey("ListId");

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

            modelBuilder.Entity("ClaudeDo.Data.Models.ListEntity", b =>
                {
                    b.Property<string>("Id")
                        .HasColumnType("TEXT")
                        .HasColumnName("id");

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

                    b.Property<string>("DefaultCommitType")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT")
                        .HasDefaultValue("chore")
                        .HasColumnName("default_commit_type");

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

                    b.Property<string>("WorkingDir")
                        .HasColumnType("TEXT")
                        .HasColumnName("working_dir");

                    b.HasKey("Id");

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

            modelBuilder.Entity("ClaudeDo.Data.Models.SubtaskEntity", b =>
                {
                    b.Property<string>("Id")
                        .HasColumnType("TEXT")
                        .HasColumnName("id");

                    b.Property<bool>("Completed")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER")
                        .HasDefaultValue(false)
                        .HasColumnName("completed");

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

                    b.Property<int>("OrderNum")
                        .HasColumnType("INTEGER")
                        .HasColumnName("order_num");

                    b.Property<string>("TaskId")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("task_id");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("title");

                    b.HasKey("Id");

                    b.HasIndex("TaskId")
                        .HasDatabaseName("idx_subtasks_task_id");

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

            modelBuilder.Entity("ClaudeDo.Data.Models.TagEntity", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER")
                        .HasColumnName("id");

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

                    b.HasKey("Id");

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

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

                    b.HasData(
                        new
                        {
                            Id = 1L,
                            Name = "agent"
                        },
                        new
                        {
                            Id = 2L,
                            Name = "manual"
                        });
                });

            modelBuilder.Entity("ClaudeDo.Data.Models.TaskEntity", b =>
                {
                    b.Property<string>("Id")
                        .HasColumnType("TEXT")
                        .HasColumnName("id");

                    b.Property<string>("AgentPath")
                        .HasColumnType("TEXT")
                        .HasColumnName("agent_path");

                    b.Property<string>("CommitType")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT")
                        .HasDefaultValue("chore")
                        .HasColumnName("commit_type");

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

                    b.Property<string>("Description")
                        .HasColumnType("TEXT")
                        .HasColumnName("description");

                    b.Property<DateTime?>("FinishedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("finished_at");

                    b.Property<bool>("IsMyDay")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER")
                        .HasDefaultValue(false)
                        .HasColumnName("is_my_day");

                    b.Property<bool>("IsStarred")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER")
                        .HasDefaultValue(false)
                        .HasColumnName("is_starred");

                    b.Property<string>("ListId")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("list_id");

                    b.Property<string>("LogPath")
                        .HasColumnType("TEXT")
                        .HasColumnName("log_path");

                    b.Property<string>("Model")
                        .HasColumnType("TEXT")
                        .HasColumnName("model");

                    b.Property<string>("Notes")
                        .HasColumnType("TEXT")
                        .HasColumnName("notes");

                    b.Property<string>("Result")
                        .HasColumnType("TEXT")
                        .HasColumnName("result");

                    b.Property<DateTime?>("ScheduledFor")
                        .HasColumnType("TEXT")
                        .HasColumnName("scheduled_for");

                    b.Property<int>("SortOrder")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER")
                        .HasDefaultValue(0)
                        .HasColumnName("sort_order");

                    b.Property<DateTime?>("StartedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("started_at");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("status");

                    b.Property<string>("SystemPrompt")
                        .HasColumnType("TEXT")
                        .HasColumnName("system_prompt");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("title");

                    b.HasKey("Id");

                    b.HasIndex("ListId")
                        .HasDatabaseName("idx_tasks_list_id");

                    b.HasIndex("Status")
                        .HasDatabaseName("idx_tasks_status");

                    b.HasIndex("ListId", "SortOrder")
                        .HasDatabaseName("idx_tasks_list_sort");

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

            modelBuilder.Entity("ClaudeDo.Data.Models.TaskRunEntity", b =>
                {
                    b.Property<string>("Id")
                        .HasColumnType("TEXT")
                        .HasColumnName("id");

                    b.Property<string>("ErrorMarkdown")
                        .HasColumnType("TEXT")
                        .HasColumnName("error_markdown");

                    b.Property<int?>("ExitCode")
                        .HasColumnType("INTEGER")
                        .HasColumnName("exit_code");

                    b.Property<DateTime?>("FinishedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("finished_at");

                    b.Property<bool>("IsRetry")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER")
                        .HasDefaultValue(false)
                        .HasColumnName("is_retry");

                    b.Property<string>("LogPath")
                        .HasColumnType("TEXT")
                        .HasColumnName("log_path");

                    b.Property<string>("Prompt")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("prompt");

                    b.Property<string>("ResultMarkdown")
                        .HasColumnType("TEXT")
                        .HasColumnName("result_markdown");

                    b.Property<int>("RunNumber")
                        .HasColumnType("INTEGER")
                        .HasColumnName("run_number");

                    b.Property<string>("SessionId")
                        .HasColumnType("TEXT")
                        .HasColumnName("session_id");

                    b.Property<DateTime?>("StartedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("started_at");

                    b.Property<string>("StructuredOutputJson")
                        .HasColumnType("TEXT")
                        .HasColumnName("structured_output");

                    b.Property<string>("TaskId")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("task_id");

                    b.Property<int?>("TokensIn")
                        .HasColumnType("INTEGER")
                        .HasColumnName("tokens_in");

                    b.Property<int?>("TokensOut")
                        .HasColumnType("INTEGER")
                        .HasColumnName("tokens_out");

                    b.Property<int?>("TurnCount")
                        .HasColumnType("INTEGER")
                        .HasColumnName("turn_count");

                    b.HasKey("Id");

                    b.HasIndex("TaskId")
                        .HasDatabaseName("idx_task_runs_task_id");

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

            modelBuilder.Entity("ClaudeDo.Data.Models.WorktreeEntity", b =>
                {
                    b.Property<string>("TaskId")
                        .HasColumnType("TEXT")
                        .HasColumnName("task_id");

                    b.Property<string>("BaseCommit")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("base_commit");

                    b.Property<string>("BranchName")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("branch_name");

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

                    b.Property<string>("DiffStat")
                        .HasColumnType("TEXT")
                        .HasColumnName("diff_stat");

                    b.Property<string>("HeadCommit")
                        .HasColumnType("TEXT")
                        .HasColumnName("head_commit");

                    b.Property<string>("Path")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("path");

                    b.Property<string>("State")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT")
                        .HasDefaultValue("active")
                        .HasColumnName("state");

                    b.HasKey("TaskId");

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

            modelBuilder.Entity("list_tags", b =>
                {
                    b.Property<string>("list_id")
                        .HasColumnType("TEXT");

                    b.Property<long>("tag_id")
                        .HasColumnType("INTEGER");

                    b.HasKey("list_id", "tag_id");

                    b.HasIndex("tag_id");

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

            modelBuilder.Entity("task_tags", b =>
                {
                    b.Property<string>("task_id")
                        .HasColumnType("TEXT");

                    b.Property<long>("tag_id")
                        .HasColumnType("INTEGER");

                    b.HasKey("task_id", "tag_id");

                    b.HasIndex("tag_id");

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

            modelBuilder.Entity("ClaudeDo.Data.Models.ListConfigEntity", b =>
                {
                    b.HasOne("ClaudeDo.Data.Models.ListEntity", "List")
                        .WithOne("Config")
                        .HasForeignKey("ClaudeDo.Data.Models.ListConfigEntity", "ListId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ClaudeDo.Data.Models.SubtaskEntity", b =>
                {
                    b.HasOne("ClaudeDo.Data.Models.TaskEntity", "Task")
                        .WithMany("Subtasks")
                        .HasForeignKey("TaskId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ClaudeDo.Data.Models.TaskEntity", b =>
                {
                    b.HasOne("ClaudeDo.Data.Models.ListEntity", "List")
                        .WithMany("Tasks")
                        .HasForeignKey("ListId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ClaudeDo.Data.Models.TaskRunEntity", b =>
                {
                    b.HasOne("ClaudeDo.Data.Models.TaskEntity", "Task")
                        .WithMany("Runs")
                        .HasForeignKey("TaskId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ClaudeDo.Data.Models.WorktreeEntity", b =>
                {
                    b.HasOne("ClaudeDo.Data.Models.TaskEntity", "Task")
                        .WithOne("Worktree")
                        .HasForeignKey("ClaudeDo.Data.Models.WorktreeEntity", "TaskId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("list_tags", b =>
                {
                    b.HasOne("ClaudeDo.Data.Models.ListEntity", null)
                        .WithMany()
                        .HasForeignKey("list_id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ClaudeDo.Data.Models.TagEntity", null)
                        .WithMany()
                        .HasForeignKey("tag_id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("task_tags", b =>
                {
                    b.HasOne("ClaudeDo.Data.Models.TagEntity", null)
                        .WithMany()
                        .HasForeignKey("tag_id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ClaudeDo.Data.Models.TaskEntity", null)
                        .WithMany()
                        .HasForeignKey("task_id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ClaudeDo.Data.Models.ListEntity", b =>
                {
                    b.Navigation("Config");

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

            modelBuilder.Entity("ClaudeDo.Data.Models.TaskEntity", b =>
                {
                    b.Navigation("Runs");

                    b.Navigation("Subtasks");

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