MOBILISIS-Calculator/library/include/mobilisis/tariff_cfg.h

58 lines
1.6 KiB
C++

#include <variant>
#include <cstddef>
#include <stdio.h>
#include <unordered_map>
#include <rapidjson/rapidjson.h>
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
#include <algorithm>
#include "tariff_currency.h"
#include "tariff_duration.h"
#include "tariff_payment_mtd.h"
#include "tariff_payment_opt.h"
#include "tariff_spec_days.h"
#include "tariff_payment_opt.h"
#include "tariff_weekdays.h"
#include "tariff_weekdays_worktime.h"
#include "tariff_spec_days_worktime.h"
#include "tariff_member_type.h"
#include "tariff_period_year.h"
#include "tariff_payment_rate.h"
#include <vector>
using namespace std;
using namespace rapidjson;
/// <summary>
/// Tariff configuration class
/// </summary>
class TariffConfiguration
{
public:
vector<TariffCurrency> Currency;
vector<TariffDuration> Duration;
vector<TariffPaymentMethod> PaymentMethod;
vector<TariffPaymentRate> PaymentRate;
vector<TariffSpecialDaysWorktime> SpecialDaysWorktime;
vector<TariffSpecialDays> SpecialDays;
vector<TariffWeekDays> WeekDays;
vector<TariffPeriodYear> YearPeriod;
vector<TariffWeekDaysWorktime> WeekDaysWorktime;
vector<TariffPaymentOption> PaymentOption;
/// <summary>
/// Parse JSON string
/// </summary>
/// <param name="json"></param>
/// <returns>Returns operation status bool (OK | FAIL) </returns>
bool ParseJson(TariffConfiguration* tariff_cfg, const char* json);
private:
/// <summary>
/// Identify type of JSON member
/// </summary>
/// <param name="member_name"></param>
/// <returns></returns>
MemberType IdentifyJsonMember(const char* member_name);
};