package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `checkout` 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 checkoutLevel(): Level = level(
    id = "checkout",
    title = "Checkout",
    description = "Create and switch to a new branch called my_branch. You will need to create a branch like you did in the previous level.",
    hints = listOf("Try looking up `git checkout` and `git branch`."),
    commandSuggestions = listOf("git checkout -b my_branch"),
    setup = { RepoState(initialized = true, files = listOf(GitFile("README", tracked = true)), commits = listOf(CommitNode("0000001", "initial commit")), branches = mapOf("master" to 1)) },
    validator = repoPredicate { repo -> repo.headBranch == "my_branch" && "my_branch" in repo.branches },
    testCases = listOf(
        levelTestCase("checkout new branch", "git checkout -b my_branch"),
    ),
)
