package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `cherry-pick` 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 cherryPickLevel(): Level = level(
    id = "cherry-pick",
    title = "Cherry Pick",
    description = "Your new feature isn't worth the time and you're going to delete it. But it has one commit that fills in `README` file, and you want this commit to be on the master as well.",
    hints = listOf("Sneak a peek at the `git help cherry-pick` command."),
    commandSuggestions = listOf("git cherry-pick feature"),
    setup = { RepoState(initialized = true, files = listOf(GitFile("nokia.js", tracked = true)), commits = listOf(CommitNode("1", "Initial"), CommitNode("2", "Master work")), branches = mapOf("master" to 2, "feature" to 3)) },
    validator = repoPredicate { repo -> repo.files.any { it.name == "README" && it.tracked } && repo.headBranch == "master" },
    testCases = listOf(
        levelTestCase("cherry pick feature tip", "git cherry-pick feature"),
    ),
)
