/* -*- Mode: C++; indent-tabs-mode: nil; tab-width: 4 -*-
 * -*- coding: utf-8 -*-
 *
 * Copyright (C) 2025 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
 * the Free Software Foundation, either version 3 of the License, or
 * 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 <http://www.gnu.org/licenses/>.
 */

#ifndef IVOLUMESLIDERITEM_H
#define IVOLUMESLIDERITEM_H

#include <memory>
#include <QLabel>
#include <QPushButton>

/**
* @brief 包含VolumeSlider子项的类型
*/
enum class VolumeSliderType
{
    VOLUME_SLIDER_INPUT = 0,  // 输入音量子项
    VOLUME_SLIDER_OUTPUT,     // 输出音量子项
    VOLUME_SLIDER_BALANCE,    // 平衡音量子项
    VOLUME_SLIDER_INPUTLEVEL, // 输入反馈子项
    VOLUME_SLIDER_SINKINPUT
};

static const char* iconNameOutputs[] = {
        "audio-volume-muted-symbolic",
        "audio-volume-low-symbolic",
        "audio-volume-medium-symbolic",
        "audio-volume-high-symbolic",
        NULL
};

static const char* iconNameInputs[] = {
        "microphone-sensitivity-muted-symbolic",
        "microphone-sensitivity-low-symbolic",
        "microphone-sensitivity-medium-symbolic",
        "microphone-sensitivity-high-symbolic",
        NULL
};

class IVolumeSlider {
public:
    virtual void setRange(int, int) = 0;

    virtual void setValue(int) = 0;

    virtual void setEnabled(bool) = 0;

    virtual bool isEnabled() const = 0;

    virtual uint32_t getValue() const = 0;

    virtual QWidget* getWidget() = 0;
};

class IVolumeSliderItem {
public:
    IVolumeSliderItem(std::shared_ptr<IVolumeSlider>, QLabel*);
    virtual ~IVolumeSliderItem() = default;

public:
    virtual void initUi() = 0;

    virtual void initSlots() = 0;

    virtual QWidget* getWidget() = 0;

    virtual void setValue(int) = 0;

    virtual void setMute(bool) = 0;

    virtual void setEnabled(bool) = 0;

    virtual QPushButton* getMuteBtn() const = 0;

    std::shared_ptr<IVolumeSlider> getSlider() const;

    void setRange(int, int);

protected:
    std::shared_ptr<IVolumeSlider> m_pVolumeSlider = nullptr;
    QLabel* m_pDisplayLabel = nullptr;
};

#endif // IVOLUMESLIDERITEM_H
