package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `fetch` 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 fetchLevel(): Level = level(
    id = "fetch",
    title = "Fetch",
    description = "Looks like a new branch was pushed into our remote repository. Get the changes without merging them with the local repository",
    hints = listOf("Look up the 'git fetch' command"),
    commandSuggestions = listOf("git fetch origin"),
    setup = { RepoState(initialized = true, branches = mapOf("master" to 1), remotes = mapOf("origin" to "remote")) },
    validator = repoPredicate { repo -> "origin/new_branch" in repo.fetchedBranches && repo.headBranch == "master" },
    testCases = listOf(
        levelTestCase("fetch origin", "git fetch origin"),
        levelTestCase("fetch default", "git fetch"),
    ),
)
