//
// Test backward compatibility of version-specific header includes
// This test verifies that existing code can still use version-specific
// includes like #include "framecpp/Version9/FrameSpec.hh"
//
// This validates that Session 2's VersionRegistry consolidation maintains
// backward-compatible include paths for downstream code.
//

#include <iostream>

// Test that all version-specific headers can be included with old paths
// These headers are now located in Universal/VersionRegistry/VersionN/
// but are symlinked to framecpp/VersionN/ for backward compatibility
#include "framecpp/Version3/FrameSpec.hh"
#include "framecpp/Version4/FrameSpec.hh"
#include "framecpp/Version5/FrameSpec.hh"
#include "framecpp/Version6/FrameSpec.hh"
#include "framecpp/Version7/FrameSpec.hh"
#include "framecpp/Version8/FrameSpec.hh"
#include "framecpp/Version9/FrameSpec.hh"

// Test that public API still works
#include "framecpp/FrameCPP.hh"

// Test that VersionRegistry header is accessible
#include "framecpp/Universal/VersionRegistry.hh"

int main()
{
    std::cout << "Testing backward compatibility of version-specific headers\n";
    std::cout << "============================================================\n\n";

    // Initialize all version specs via the new VersionRegistry
    std::cout << "Initializing all version specs via VersionRegistry...\n";
    FrameCPP::Initialize();
    std::cout << "✓ FrameCPP::Initialize() completed successfully\n\n";

    // Verify that version-specific headers define the expected namespaces
    std::cout << "Verifying version-specific namespaces exist:\n";

    // Check for Version_3 namespace (defined in Version3/FrameSpec.hh)
    #ifdef FrameCPP__VERSION_3__Specs_HH
    std::cout << "✓ Version 3: FrameSpec.hh header guard found\n";
    #else
    std::cout << "✗ Version 3: FrameSpec.hh header guard missing\n";
    return 1;
    #endif

    // Check for Version_9 namespace (defined in Version9/FrameSpec.hh)
    #ifdef FrameCPP__VERSION_9__Specs_HH
    std::cout << "✓ Version 9: FrameSpec.hh header guard found\n";
    #else
    std::cout << "✗ Version 9: FrameSpec.hh header guard missing\n";
    return 1;
    #endif

    // Check for VersionRegistry header
    #ifdef FrameCPP__Universal__VersionRegistry_HH
    std::cout << "✓ VersionRegistry: Header accessible via framecpp/Universal/VersionRegistry.hh\n";
    #else
    std::cout << "✗ VersionRegistry: Header not found\n";
    return 1;
    #endif

    std::cout << "\n============================================================\n";
    std::cout << "SUCCESS: All backward compatibility checks passed!\n";
    std::cout << "============================================================\n";
    std::cout << "\nLegacy include paths work correctly:\n";
    std::cout << "  - #include \"framecpp/Version3/FrameSpec.hh\" ✓\n";
    std::cout << "  - #include \"framecpp/Version4/FrameSpec.hh\" ✓\n";
    std::cout << "  - #include \"framecpp/Version5/FrameSpec.hh\" ✓\n";
    std::cout << "  - #include \"framecpp/Version6/FrameSpec.hh\" ✓\n";
    std::cout << "  - #include \"framecpp/Version7/FrameSpec.hh\" ✓\n";
    std::cout << "  - #include \"framecpp/Version8/FrameSpec.hh\" ✓\n";
    std::cout << "  - #include \"framecpp/Version9/FrameSpec.hh\" ✓\n";
    std::cout << "\nNew VersionRegistry header also accessible:\n";
    std::cout << "  - #include \"framecpp/Universal/VersionRegistry.hh\" ✓\n";

    return 0;
}
