package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `rm` 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 rmLevel(): Level = level(
    id = "rm",
    title = "Rm",
    description = "A file has been removed from the working tree, but not from the repository. Identify this file and remove it.",
    hints = emptyList(),
    commandSuggestions = listOf("git status", "git rm deleteme.rb"),
    setup = { RepoState(initialized = true, files = listOf(GitFile("deleteme.rb", tracked = true, deleted = true)), commits = listOf(CommitNode("0000001", "Added a temp file")), branches = mapOf("master" to 1)) },
    validator = repoPredicate { repo ->
        repo.files.none { it.name == "deleteme.rb" } ||
            repo.files.any { it.name == "deleteme.rb" && it.deleted && it.staged }
    },
    testCases = listOf(
        levelTestCase("git rm deleted path", "git rm deleteme.rb"),
    ),
)
