package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `rename_commit` 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 renameCommitLevel(): Level = level(
    id = "rename_commit",
    title = "Rename Commit",
    description = "Correct the typo in the message of your first (non-root) commit.",
    hints = listOf("Take a look the `-i` flag of the rebase command."),
    commandSuggestions = listOf("git rebase -i HEAD~2"),
    setup = { RepoState(initialized = true, commits = listOf(CommitNode("1", "Initial commit"), CommitNode("2", "First coommit"), CommitNode("3", "Second commit")), branches = mapOf("master" to 3)) },
    validator = repoPredicate { repo -> repo.commits.any { it.message == "First commit" } && repo.commits.none { it.message.contains("coommit") } },
    testCases = listOf(
        levelTestCase("interactive rebase rename", "git rebase -i HEAD~2"),
    ),
)
