package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `reset_soft` level.
 *
 * Setup documents the repository shape the learner explores. Evaluation is kept
 * state-based whenever the exercise changes repository objects; answer-only
 * levels intentionally validate the answer entered at the prompt.
 */
internal fun resetSoftLevel(): Level = level(
    id = "reset_soft",
    title = "Reset Soft",
    description = "You committed too soon. Now you want to undo the last commit, while keeping the index.",
    hints = listOf("What are some options you can use with `git reset`?"),
    commandSuggestions = listOf("git reset --soft HEAD^"),
    setup = { RepoState(initialized = true, files = listOf(GitFile("README", tracked = true), GitFile("newfile.rb", tracked = true)), commits = listOf(CommitNode("0000001", "Initial commit"), CommitNode("0000002", "Premature commit")), branches = mapOf("master" to 2)) },
    validator = repoPredicate { repo -> repo.commits.size == 1 && repo.files.any { it.name == "newfile.rb" && it.staged } },
    testCases = listOf(
        levelTestCase("soft reset caret", "git reset --soft HEAD^"),
    ),
)
