/*
 * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd.
 *
 * Author:     Iceyer <me@iceyer.net>
 *
 * Maintainer: Iceyer <me@iceyer.net>
 *
 * 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
 * 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 LICENSEINFO_H
#define LICENSEINFO_H

#include <QObject>

#include "licensedbus.h"

#define MAX_LICENSE_SIZE (64*1024)

class LicenseKernel;

class LicenseInfo: public QObject
{
    Q_OBJECT
    Q_CLASSINFO("D-Bus Interface", INFO_INTERFACE_NAME)
    Q_PROPERTY(QString Organization READ organization)
    Q_PROPERTY(QString Product READ product)
    Q_PROPERTY(QString Copyright READ copyright)
    Q_PROPERTY(QString Edition READ edition)
    Q_PROPERTY(quint32 LicenseState READ licenseSatus)
    Q_PROPERTY(QString ValidityBegin READ validityBegin)
    Q_PROPERTY(QString ValidityEnd READ validityEnd)

signals:
    void LicenseStateChange(quint32);

public:
    LicenseInfo(const LicenseKernel *kernel, QObject *parent = nullptr);

    quint32 notifyLicenseState();

public:
    QString organization();
    QString product();
    QString copyright();
    QString edition();
    QString machineCode();
    QString validityBegin();
    QString validityEnd();
    quint32 licenseSatus();

private:
    const LicenseKernel *m_kernel;
};

#endif // LICENSEINFO_HH
