/*
  ==============================================================================

    KeyzyLicenseDepositHandler.h
    Created: 26 May 2023 12:55:33pm
    Author:  Volkan Ozyilmaz

  ==============================================================================
*/

#ifndef KEYZY_LICENSE_DEPOSIT_HANDLER_H
#define KEYZY_LICENSE_DEPOSIT_HANDLER_H

#include "KeyzyTypes.h"
#include <memory>

namespace Keyzy {

class KeyzyLicenseProvider;

/*!
 * LicenseDepositHandler is used for depoisting licenses from the client device.
 */
class LicenseDepositHandler
{
public:
    /*!
     * Create an instance of LicenseDepositHandler
     *
     * @param KeyzyLicenseProvider
     */
    LicenseDepositHandler(std::shared_ptr<KeyzyLicenseProvider> licenseProvider);
    ~LicenseDepositHandler();
    
    /**
     * registerTrial registers a trial license on the KEYZY service and brings the information to the device.
     *
     * @param licenseInfo
     * It's filled by the function with the trial license information of a license.
     *
     * @param skuNumber
     * A trial license is deposited for this SKU Number.
     *
     * @param name
     * Optional.\n
     * If it's filled, the trial license is deposited with the name parameter.
     *
     * @param email
     * Optional.\n
     * If it's filled, the trial license is deposited with the email parameter.
     *
     */
    LicenseStatus registerTrial(LicenseInfo& licenseInfo,
                                const std::string& skuNumber,
                                const std::string& name = std::string(),
                                const std::string& email = std::string());

    /**
     * registerOfflineDistributedLicense updates the name and the email information of an offline license.
     * If you are unsure of what an offline (dealer) license means, please check for more information on the keyzy.io domain.
     *
     * @param serial number
     * The serial number that the information will be set.
     *
     * @param name
     * Optional.\n
     * If it's filled, the trial license is deposited with the name parameter.
     *
     * @param email
     * Optional.\n
     * If it's filled, the trial license is deposited with the email parameter.
     *
    */
    LicenseStatus registerOfflineDistributedLicense(const std::string& serialNumber,
                                                    const std::string& name = std::string(),
                                                    const std::string& email = std::string());
    
private:
    std::shared_ptr<KeyzyLicenseProvider> _licenseProvider;
};

}

#endif // KEYZY_LICENSE_DEPOSIT_HANDLER_H
