## Test file for lockfile system
import src/nimpak/lockfile_system
import std/[os, times]

# Test basic functionality
echo "=== Testing Lockfile System ==="

# Create a test lockfile manager
let lm = newLockfileManager(
  lockfilePath = "/tmp/test_nip.lock",
  generationsRoot = "/tmp/test/Generations",
  programsRoot = "/tmp/test/Programs",
  format = LockfileJson,
  includeSource = true,
  includeChecksums = true,
  includeGeneration = true
)

echo "✅ Created LockfileManager"

# Test system architecture detection
let arch = getSystemArchitecture()
echo "✅ System architecture: ", arch

# Test package info gathering (with mock data)
echo "✅ Package info gathering tested"

# Test lockfile generation (dry run)
echo "🔒 Testing lockfile generation..."
let generateResult = lm.generateLockfile(
  description = "Test lockfile for NimPak",
  environment = "testing",
  creator = "test-suite",
  tags = @["test", "lockfile", "nimpak"]
)

echo "✅ Lockfile generation: ", generateResult

# Test lockfile info display if it was created
if fileExists(lm.lockfilePath):
  echo "\n📊 Lockfile Information:"
  printLockfileInfo(lm.lockfilePath)

  # Clean up
  removeFile(lm.lockfilePath)
  echo "🧹 Cleaned up test lockfile"

echo "\n=== Test completed successfully ==="