/*
 *
 *    Copyright (c) 2025 Project CHIP Authors
 *    All rights reserved.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
#pragma once
#include "webrtc-abstract.h"
#include "webrtc-provider-manager.h"
#include <lib/support/logging/CHIPLogging.h>

void webrtc_bridge_message_received_cb(void * data, int len);

class EspWebRTCPeerConnection {
private:
    std::string peerConnectionId;

public:
    EspWebRTCPeerConnection(std::string peerConnectionId)
    {
        this->peerConnectionId = peerConnectionId;
    }
    std::string GetPeerConnectionId()
    {
        return peerConnectionId;
    }
};

class KVSWebRTCPeerConnection : public WebRTCPeerConnection {
public:
    KVSWebRTCPeerConnection();

    void SetCallbacks(OnLocalDescriptionCallback onLocalDescription, OnICECandidateCallback onICECandidate,
                      OnConnectionStateCallback onConnectionState, OnTrackCallback onTrack) override;
    void Close() override;
    void CreateOffer(uint16_t sessionId) override;
    void CreateAnswer() override;
    void SetRemoteDescription(const std::string  &sdp, SDPType type) override;
    void AddRemoteCandidate(const std::string  &candidate, const std::string  &mid) override;
    std::shared_ptr<WebRTCTrack> AddTrack(MediaType mediaType) override;
    std::string GetPeerConnectionId();

private:
    std::shared_ptr<EspWebRTCPeerConnection> mPeerConnection;
};
