package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `number_of_files_committed` 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 numberOfFilesCommittedLevel(): Level = level(
    id = "number_of_files_committed",
    title = "Number Of Files Committed",
    description = "There are some files in this repository; how many of them are staged for a commit?",
    hints = listOf("You are looking for a command to identify the status of the repository (resembles a Linux command)."),
    commandSuggestions = listOf("git status"),
    setup = { RepoState(initialized = true, files = listOf(GitFile("rubyfile1.rb", staged = true), GitFile("rubyfile4.rb", "#Changes", staged = true, tracked = true), GitFile("rubyfile5.rb", "#Changes", tracked = true), GitFile("rubyfile6.rb"), GitFile("rubyfile7.rb")), branches = mapOf("master" to 1)) },
    validator = commandAnswer("2"),
    nativeSetup = {
        resetFiles()
        write("rubyfile4.rb")
        write("rubyfile5.rb")
        addCommit("Commit", "rubyfile4.rb", "rubyfile5.rb")
        write("rubyfile4.rb", "#Changes")
        add("rubyfile4.rb")
        write("rubyfile5.rb", "#Changes")
        write("rubyfile1.rb")
        add("rubyfile1.rb")
        write("rubyfile6.rb")
        write("rubyfile7.rb")
        true
    },
    testCases = listOf(
        levelTestCase("answer staged count", "2"),
    ),
)
