package de.arxsilex.maptools.converter.core.mtci

import java.nio.file.Path

fun main(arguments: Array<String>) {
    require(arguments.size == 1) { "Aufruf: MtciValidateCli <mtci-verzeichnis>" }
    val directory = Path.of(arguments[0]).toAbsolutePath().normalize()
    val startedAt = System.nanoTime()
    val report = MtciIntegrityValidator.validate(directory)
    println(
        "MTCI-VALIDATE valid=${report.valid} nodes=${report.nodeCount} ways=${report.wayCount} " +
            "relations=${report.relationCount} duplicateNodes=${report.duplicateNodeIds} " +
            "duplicateWays=${report.duplicateWayIds} duplicateRelations=${report.duplicateRelationIds} " +
            "missingWayNodes=${report.missingWayNodeReferences} " +
            "missingRelationMembers=${report.missingRelationMemberReferences} " +
            "elapsedMs=${(System.nanoTime() - startedAt) / 1_000_000L}",
    )
    report.requireValid()
}
