/*******************************************************************************
 * Copyright (c) 2026, Jan Koester jan.koester@gmx.net
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 * Neither the name of the <organization> nor the
 *      names of its contributors may be used to endorse or promote products
 *      derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *******************************************************************************/

#pragma once

#include <QObject>
#include <QColor>

class ThemeProvider : public QObject {
    Q_OBJECT

    Q_PROPERTY(bool   dark          READ dark          CONSTANT)

    Q_PROPERTY(QColor bgPrimary     READ bgPrimary     CONSTANT)
    Q_PROPERTY(QColor bgSecondary   READ bgSecondary   CONSTANT)
    Q_PROPERTY(QColor bgTertiary    READ bgTertiary    CONSTANT)
    Q_PROPERTY(QColor bgHover       READ bgHover       CONSTANT)

    Q_PROPERTY(QColor textPrimary   READ textPrimary   CONSTANT)
    Q_PROPERTY(QColor textSecondary READ textSecondary CONSTANT)
    Q_PROPERTY(QColor textMuted     READ textMuted     CONSTANT)

    Q_PROPERTY(QColor accent        READ accent        CONSTANT)
    Q_PROPERTY(QColor accentHover   READ accentHover   CONSTANT)
    Q_PROPERTY(QColor border        READ border        CONSTANT)
    Q_PROPERTY(QColor success       READ success       CONSTANT)
    Q_PROPERTY(QColor warning       READ warning       CONSTANT)
    Q_PROPERTY(QColor danger        READ danger        CONSTANT)

    Q_PROPERTY(int    radius        READ radius        CONSTANT)

public:
    explicit ThemeProvider(bool isDark, QObject *parent = nullptr)
        : QObject(parent), _dark(isDark) {}

    bool dark() const { return _dark; }

    QColor bgPrimary()     const { return _dark ? QColor("#1e1e2e") : QColor("#f5f5f7"); }
    QColor bgSecondary()   const { return _dark ? QColor("#2b2b3d") : QColor("#e8e8ec"); }
    QColor bgTertiary()    const { return _dark ? QColor("#363650") : QColor("#dcdce2"); }
    QColor bgHover()       const { return _dark ? QColor("#3f3f5c") : QColor("#d0d0d8"); }

    QColor textPrimary()   const { return _dark ? QColor("#cdd6f4") : QColor("#1c1c1e"); }
    QColor textSecondary() const { return _dark ? QColor("#9399b2") : QColor("#48484a"); }
    QColor textMuted()     const { return _dark ? QColor("#6c7086") : QColor("#8e8e93"); }

    QColor accent()        const { return _dark ? QColor("#89b4fa") : QColor("#0071e3"); }
    QColor accentHover()   const { return _dark ? QColor("#74c7ec") : QColor("#0077ed"); }
    QColor border()        const { return _dark ? QColor("#45475a") : QColor("#c6c6c8"); }
    QColor success()       const { return _dark ? QColor("#a6e3a1") : QColor("#34c759"); }
    QColor warning()       const { return _dark ? QColor("#f9e2af") : QColor("#ff9f0a"); }
    QColor danger()        const { return _dark ? QColor("#f38ba8") : QColor("#ff3b30"); }

    int radius() const { return 6; }

private:
    bool _dark;
};
