package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `find_old_branch` 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 findOldBranchLevel(): Level = level(
    id = "find_old_branch",
    title = "Find Old Branch",
    description = "You have been working on a branch but got distracted by a major issue. Switch back to that branch even though you forgot the name of it.",
    hints = listOf("Ever played with the `git reflog` command?"),
    commandSuggestions = listOf("git checkout solve_world_hunger"),
    setup = { RepoState(initialized = true, branches = mapOf("master" to 1, "solve_world_hunger" to 2)) },
    validator = repoPredicate { repo -> repo.headBranch == "solve_world_hunger" },
    testCases = listOf(
        levelTestCase("checkout old branch", "git checkout solve_world_hunger"),
    ),
)
