#ifndef __OCPP16_AUTHORIZATION_H__
#define __OCPP16_AUTHORIZATION_H__
#include "msystem.h"
#include "ocpp16.h"

/****************************************************************************************************/

typedef struct AuthorizationDataNFC
{
    uint8_t idTag[24];
    time_t expiryDate;
    uint8_t parentIdTag[24];
    AuthorizationStatus_t status;
}AuthorizationDataNFC_t;
typedef struct AuthorizationList
{
    int count;
    AuthorizationDataNFC_t *items;
}AuthorizationList_t;
/****************************************************************************************************/

extern AuthorizationList_t  authorizationCache;
extern AuthorizationList_t  localAuthorizationList;

int ocpp16_AuthorizationCache_append(uint8_t* idTag, uint8_t* parentIdTag, time_t expiryDate, AuthorizationStatus_t);
AuthorizationDataNFC_t* copp16_AuthorizationCache_find(const uint8_t* idTag);

AuthorizationDataNFC_t* copp16_LocalAuthorizationList_find(const uint8_t* idTag);
int ocpp16_LocalAuthorizationList_append(uint8_t* idTag, uint8_t* parentIdTag, time_t expiryDate, AuthorizationStatus_t status);

void ocpp16_authorization_save(AuthorizationList_t* local, AuthorizationList_t* cache, const char* filename);
void ocpp16_authorization_load(AuthorizationList_t* local, AuthorizationList_t* cache, const char* filename);

void ocpp16_authorization_init(void);
void ocpp16_authorization_exit(void);

#endif//__OCPP16_AUTHORIZATION_H__
