package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `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 branchLevel(): Level = level(
    id = "branch",
    title = "Branch",
    description = "To work on a piece of code that has the potential to break things, create the branch test_code.",
    hints = listOf("`git branch` is what you want to investigate."),
    commandSuggestions = listOf("git branch test_code"),
    setup = { RepoState(initialized = true, files = listOf(GitFile("README", tracked = true)), commits = listOf(CommitNode("0000001", "Initial commit")), branches = mapOf("master" to 1)) },
    validator = repoPredicate { repo -> "test_code" in repo.branches && repo.headBranch == "master" },
    testCases = listOf(
        levelTestCase("create branch", "git branch test_code"),
    ),
)
