package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `rename` 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 renameLevel(): Level = level(
    id = "rename",
    title = "Rename",
    description = "We have a file called `oldfile.txt`. We want to rename it to `newfile.txt` and stage this change.",
    hints = listOf("Take a look at `git mv`."),
    commandSuggestions = listOf("git mv oldfile.txt newfile.txt"),
    setup = { RepoState(initialized = true, files = listOf(GitFile("oldfile.txt", tracked = true)), commits = listOf(CommitNode("0000001", "Committed oldfile.txt")), branches = mapOf("master" to 1)) },
    validator = repoPredicate { repo -> repo.files.any { it.name == "newfile.txt" } && repo.files.none { it.name == "oldfile.txt" && !it.deleted } },
    testCases = listOf(
        levelTestCase("git mv", "git mv oldfile.txt newfile.txt"),
    ),
)
