#include "ocpp21_datatype.h"


int AbsolutePriceScheduleType_encode(cJSON *parent, const char* name, AbsolutePriceScheduleType_t *value)
{
    if (value)
    {
        if (parent && name )
        {
            cJSON *object = cJSON_AddObjectToObject(parent, name);
            if (object)
            {
                cJSON_AddStringToObject(object, "timeAnchor", value->timeAnchor);
                cJSON_AddNumberToObject(object, "priceScheduleID", value->priceScheduleID);
                if (value->priceScheduleDescription_isUsed) { cJSON_AddStringToObject(object, "priceScheduleDescription", value->priceScheduleDescription); }
                if (value->currency_isUsed) { cJSON_AddStringToObject(object, "currency", value->currency); }
                if (value->language_isUsed) { cJSON_AddStringToObject(object, "language", value->language); }
                if (value->priceAlgorithm_isUsed) { cJSON_AddStringToObject(object, "priceAlgorithm", value->priceAlgorithm); }
                return 0;
            }
        }
    }
    return -1;
}

