/*
 * Copyright (C) 2023, KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * Authors: wangyan <wangyan@kylinos.cn>
 *
 */

#ifndef DEVICEMANAGER_H
#define DEVICEMANAGER_H

#include <QObject>
#include "common.h"

class DeviceMonitor;
class ConfigManager;
class DeviceManager : public QObject
{
    Q_OBJECT
public:
    static DeviceManager* getInstance();

    static QList<Device> getTouchDevices();
    static QList<Device> getOutputDevices();
    static QString getInputName(int id);
    static QString getInputProductId(int id);
    static QString getInputSerial(int id);
    static bool isPrimaryOutput(int id);

    void mapToOutput(int inputDeviceId, const QString& outputName);
    void calibrateTouch(int touchDeviceId, QString outputName);

signals:
    void deviceAdded(DeviceType type, int deviceid);
    void deviceRemoved(DeviceType type, int deviceid);
    void deviceEnabled(DeviceType type, int deviceid);
    void deviceDisabled(DeviceType type, int deviceid);

private:
    explicit DeviceManager(QObject *parent = nullptr);
    void initDeviceManager();

    DeviceMonitor* m_deviceMonitor;
    ConfigManager* m_configManager;
};

#endif // DEVICEMANAGER_H
