#ifndef __OCPP21_DATATYPE_H__
#define __OCPP21_DATATYPE_H__
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <time.h>
#include "cJSON.h"
#include "ocpp21_enum.h"

typedef char dateTime_t[64];

//2.1
typedef struct AbsolutePriceScheduleType
{
    dateTime_t      timeAnchor;
    int             priceScheduleID;

    char            priceScheduleDescription[164];
    int             priceScheduleDescription_isUsed;

    char            currency[4];
    int             currency_isUsed;

    char            language[12];
    int             language_isUsed;

    char            priceAlgorithm[2004];
    int             priceAlgorithm_isUsed;

}AbsolutePriceScheduleType_t;
int AbsolutePriceScheduleType_encode(cJSON *parent, const char* name, AbsolutePriceScheduleType_t *value);
int AbsolutePriceScheduleType_decode(cJSON *object, AbsolutePriceScheduleType_t *value);

//2.2
typedef struct ACChargingParametersType
{
    float           energyAmount;
    float           evMinCurrent;
    float           evMaxCurrent;
    float           evMaxVoltage;
}ACChargingParametersType_t;
int ACChargingParametersType_encode(cJSON *parent, const char* name, ACChargingParametersType_t *value);
int ACChargingParametersType_decode(cJSON *object, ACChargingParametersType_t *value);

//2.3
typedef struct AdditionalInfoType
{
    char            additionalIdToken[260];
    char            type[54];
}AdditionalInfoType_t;
int AdditionalInfoType_encode(cJSON *parent, const char* name, AdditionalInfoType_t *value);
int AdditionalInfoType_decode(cJSON *object, AdditionalInfoType_t *value);

//2.81
typedef struct RationalNumberType
{
    float           exponent;
    float           value;
}RationalNumberType_t;
int RationalNumberType_encode(cJSON *parent, const char* name, RationalNumberType_t *value);
int RationalNumberType_decode(cJSON *object, RationalNumberType_t *value);

//2.4
typedef struct AdditionalSelectedServicesType
{
    char            serviceName[84];
    RationalNumberType_t serviceFee;
}AdditionalSelectedServicesType_t;
int AdditionalSelectedServicesType_encode(cJSON *parent, const char* name, AdditionalSelectedServicesType_t *value);
int AdditionalSelectedServicesType_decode(cJSON *object, AdditionalSelectedServicesType_t *value);

//2.5
typedef struct AddressType
{
    char            name[54];
    char            address1[104];
    int             address2_isUsed;
    char            address2[104];
    char            city[104];
    int             postcode_isUsed;
    char            postcode[24];
    char            country[54];
}AddressType_t;
int AddressType_encode(cJSON *parent, const char* name, AddressType_t *value);

//2.6
typedef struct APNType
{
    char            apn[2004];
    int             anpUserName_isUsed;
    char            anpUserName[54];
    int             anpPassword_isUsed;
    char            anpPassword[54];
    int             simPin_isUsed;
    char            simPin[54];
    int             preferredNetwork_isUsed;
    char            preferredNetwork[54];
    int             useOnlyPreferredNetwork_isUsed;
    int             useOnlyPreferredNetwork;
    APNAuthenticationEnumType_t apnAuthentication;
}APNType_t;
int APNType_encode(cJSON *parent, const char* name, APNType_t *value);
int APNType_decode(cJSON *object, APNType_t *value);

#endif//__OCPP21_DATATYPE_H__