#ifndef __CCU_CONFIG_H__
#define __CCU_CONFIG_H__

#include "msystem.h"

typedef struct pcuhw_config
{
    int enable;
    char connect_ip_string[64];
    short connect_port;
    short enable_ssl;
    // char ssl_ca_filepath[128];
    // char ssl_cert_filepath[128];
    // char ssl_private_key_filepath[128];
}pcuhw_config_t;

typedef struct pcutc_config
{
    int enable;
    char connect_ip_string[64];
    short connect_port;
    short enable_ssl;
    // char ssl_ca_filepath[128];
    // char ssl_cert_filepath[128];
    // char ssl_private_key_filepath[128];
}pcutc_config_t;

typedef struct qttcu_config
{
    int enable;
    char connect_ip_string[64];
    short connect_port;
    short enable_ssl;
    // char ssl_ca_filepath[128];
    // char ssl_cert_filepath[128];
    // char ssl_private_key_filepath[128];
}qttcu_config_t;

typedef struct ocpp16_config
{
    int enable;
    char  connect_ip_string[64];
    short connect_port;
    short enable_ssl;
    char ssl_ca_filepath[128];
    char ssl_cert_filepath[128];
    char ssl_private_key_filepath[128];
}ocpp16_config_t;

typedef struct GUN_config
{
    int connectorId;
    int GUN_Type;
    int GUN_Available;
    float GUN_maxI;
    char slac_ifname[64];
    char can_ifname[64];
    int QRCode_enable;
    char QRCode_URL[256];
    int requestPowerByMinutes;
    int requestPowerByPowerKW;
    int requestPowerBySOC;
    int GUNOverTemp_Warning;
    int GUNOverTemp_Stopping;

    char root_cert_path_v2g[128];
    char root_cert_path_mo[128];
}GUN_config_t;

typedef struct ccu_config
{
    int     TCU_ID;
    char    CCU_SN[64];
    char    CCU_ProductID[64];
    char    CCU_VendorID[64];
    int     CCU_Available;

    int     BoxOverTemp_Warning;
    int     BoxOverTemp_Stopping;

    char    username[64];
    char    password[64];
    
    int     GUN_Numb;
    GUN_config_t GUN_config[2];

    pcuhw_config_t pcuhw;
    pcutc_config_t pcutc;
    qttcu_config_t qttcu;

    ocpp16_config_t ocpp16[2];
    ocpp16_config_t ocpp21[2];
}ccu_config_t;

void ccu_config_save(ccu_config_t* config, const char* filename);
void ccu_config_load(ccu_config_t* config, const char* filename);

void ccu_config_init(void);
void ccu_config_exit(void);


extern ccu_config_t ccu_config;

#endif//__CCU_CONFIG_H__
