package solutions.tretter.githugandroid

/**
 * Port of the upstream ruby-githug `conflict` 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 conflictLevel(): Level = level(
    id = "conflict",
    title = "Conflict",
    description = "You need to merge mybranch into the current branch (master). But there may be some incorrect changes in mybranch which may cause conflicts. Solve any merge-conflicts you come across and finish the merge.",
    hints = emptyList(),
    commandSuggestions = listOf("git merge mybranch"),
    setup = { RepoState(initialized = true, files = listOf(GitFile("poem.txt", tracked = true)), branches = mapOf("master" to 2, "mybranch" to 2)) },
    validator = repoPredicate { repo -> repo.files.find { it.name == "poem.txt" }?.content?.contains("Humpty Dumpty") == true },
    testCases = listOf(
        levelTestCase("merge and resolve cleanly", "git merge mybranch"),
    ),
)
