#include <iostream>
#include "api/peer_connection_interface.h"
#include "api/create_peerconnection_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "rtc_base/thread.h"

int main() {
    // Initialize WebRTC threading
    rtc::ThreadManager::Instance()->WrapCurrentThread();

    // Create a PeerConnectionFactory (basic WebRTC component)
    auto factory = webrtc::CreatePeerConnectionFactory(
        nullptr /* network_thread */,
        nullptr /* worker_thread */,
        nullptr /* signaling_thread */,
        nullptr /* default_adm */,
        webrtc::CreateBuiltinAudioEncoderFactory(),
        webrtc::CreateBuiltinAudioDecoderFactory(),
        webrtc::CreateBuiltinVideoEncoderFactory(),
        webrtc::CreateBuiltinVideoDecoderFactory(),
        nullptr /* audio_mixer */,
        nullptr /* audio_processing */
    );

    if (factory) {
        std::cout << "tg_owt library test: PeerConnectionFactory created successfully!" << std::endl;
        return 0;
    } else {
        std::cerr << "tg_owt library test: FAILED to create PeerConnectionFactory!" << std::endl;
        return 1;
    }
}
