package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `init` 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 initLevel(): Level = level(
    id = "init",
    title = "Init",
    description = "A new directory, `git_hug`, has been created; initialize an empty repository in it.",
    hints = listOf("You can type `git --help` or `git` in your shell to get a list of available git commands."),
    commandSuggestions = listOf("git init", "git status"),
    setup = { RepoState(currentDir = "git_hug") },
    validator = repoPredicate { it.initialized },
    testCases = listOf(
        levelTestCase("plain init", "git init"),
    ),
    setupChecks = listOf(
        levelSetupCheck(
            name = "starts in git_hug",
            failureMessage = "Expected the learner to start in the created git_hug directory.",
        ) { repo -> repo.currentDir == "git_hug" && !repo.initialized },
    ),
)
