#include "licenceCommon.h"

#ifndef LICENCE_GENERATOR_H_
#define LICENCE_GENERATOR_H_

#define DEFAULT_LICENCE_POINTS_COUNT = 4294967295 //počet licenčních bodů pro některé protokoly např: pt_Ez_buffer a pt_Ez_webs

#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdint.h>
#include "pugixml.hpp"

#include "licGenELC1.h"
#include "licGenELC2.h"
#include "licGenELC3.h"

using namespace std;

class LicenceGenerator
{

public:
  struct LicData
  {
    string station = "";
    string distributor = "";
    string licenceName = "";
    string projectDescription = "";
    string cid = ""; // CID z SD karty
    string csd = ""; // CSD z SD karty
    string uid = ""; // jedinečný identifikátor z jiného systému
    pugi::xml_document *doc;
  };

  LicData licData {};
  int elcSwitchType {};
  string operationErrors = "";
  pugi::xml_document doc {} ;
  bool argumentsCorrect = false;
  ErrorMessage error {};
  // LicenceELC11 *licence11;
  // LicenceELC21 *licence21;
  // LicenceELC31 *licence31;
  Mapping mapping {};
  SDCard sdCard {};

  LicenceGenerator();
  ~LicenceGenerator();
  LicenceGenerator(string uid, string cid, string csd, string dataFileName);

  void createLicenceFile();

  LicenceInfoGeneral licenceInfoGeneral {};

private:
  LicenceIdentification licIdentification;
  string configFileName = "";

  void *licence = nullptr;

  bool processInputConfiguration();

  void createLicenceELC1();
  void createLicenceELC2();
  void createLicenceELC3();
};

#endif