// SPDX-FileCopyrightText: 2024 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause

#include "mainpagecontroller.h"

/*!
 * \brief Constructor for the MainPageController class
 * \param parent Parent object
 */
MainPageController::MainPageController(QObject *parent)
    : QObject(parent), m_callManager(nullptr) { }

CallManager *MainPageController::callManager()
{
    return m_callManager;
}

void MainPageController::setCallManager(CallManager *callManager)
{
    m_callManager = callManager;
    connect(m_callManager, &CallManager::dbusErrorReceived, this,
            &MainPageController::callManagerErrorReceived);
    emit callManagerChanged();
}

/*!
 * \brief Runs the CallManager registration process.
 */
void MainPageController::registerCallManager()
{
    m_callManager->registerCallManager();
}

/*!
 * \brief Starts the incoming call via CallManager.
 */
void MainPageController::startIncomingCall()
{
    m_callManager->startIncomingCall();
}

/*!
 * \brief Starts the outgoing call via CallManager.
 */
void MainPageController::startOutgoingCall()
{
    m_callManager->startOutgoingCall();
}
