#include "ocpp21_enum.h"

/// @brief  3.1
/// @param string 
/// @return 
int APNAuthenticationEnumType_fromString(const char *string)
{
    if (string)
    {
        if (strcmp(string, "PAP")==0) return APNAuthenticationEnumType_PAP;
        if (strcmp(string, "CHAP")==0) return APNAuthenticationEnumType_CHAP;
        if (strcmp(string, "NONE")==0) return APNAuthenticationEnumType_NONE;
        if (strcmp(string, "AUTO")==0) return APNAuthenticationEnumType_AUTO;
    }
    return 0;
}

const char* APNAuthenticationEnumType_toString(APNAuthenticationEnumType_t type)
{
    switch(type)
    {
        case APNAuthenticationEnumType_PAP: return "PAP";
        case APNAuthenticationEnumType_CHAP: return "CHAP";
        case APNAuthenticationEnumType_NONE: return "NONE";
        case APNAuthenticationEnumType_AUTO: return "AUTO";
    }
    return NULL;
}

/// @brief 3.2
/// @param string 
/// @return 
int AttributeEnumType_fromString(const char *string)
{
    if (string)
    {
        if (strcmp(string, "Actual")==0) return AttributeEnumType_Actual;
        if (strnmp(string, "Target")==0) return AttributeEnumType_Target;
        if (strcmp(string, "MinSet")==0) return AttributeEnumType_MinSet;
        if (strcmp(string, "MaxSet")==0) return AttributeEnumType_MaxSet;
    }
    return 0;
}

const char* AttributeEnumType_toString(AttributeEnumType_t type)
{
    switch(type)
    {
        case AttributeEnumType_Actual: return "Actual";
        case AttributeEnumType_Target: return "Target";
        case AttributeEnumType_MinSet: return "MinSet";
        case AttributeEnumType_MaxSet: return "MaxSet";
    }
    return NULL;
}

/// @brief 3.3
/// @param string 
/// @return 
int AuthorizationStatusEnumType_fromString(const char *string)
{
    if (string)
    {
        if (strcmp(string, "Accepted")==0) return AuthorizationStatusEnumType_Accepted;
        if (strcmp(string, "Blocked")==0) return AuthorizationStatusEnumType_Blocked;
        if (strcmp(string, "ConcurrentTx")==0) return AuthorizationStatusEnumType_ConcurrentTx;
        if (strcmp(string, "Expired")==0) return AuthorizationStatusEnumType_Expired;
        if (strcmp(string, "NoCredit")==0) return AuthorizationStatusEnumType_NoCredit;
        if (strcmp(string, "NotAllowedTypeEVSE")==0) return AuthorizationStatusEnumType_NotAllowedTypeEVSE;
        if (strcmp(string, "NotAtThisLocation")==0) return AuthorizationStatusEnumType_NotAtThisLocation;
        if (strcmp(string, "NotAtThisTime")==0) return AuthorizationStatusEnumType_NotAtThisTime;
        if (strcmp(string, "Unknown")==0) return AuthorizationStatusEnumType_Unknown;
    }
    return 0;
}

const char* AuthorizationStatusEnumType_toString(AuthorizationStatusEnumType_t type)
{
    switch(type)
    {
        case AuthorizationStatusEnumType_Accepted: return "Accepted";
        case AuthorizationStatusEnumType_Blocked: return "Blocked";
        case AuthorizationStatusEnumType_ConcurrentTx: return "ConcurrentTx";
        case AuthorizationStatusEnumType_Expired: return "Expired";
        case AuthorizationStatusEnumType_NoCredit: return "NoCredit";
        case AuthorizationStatusEnumType_NotAllowedTypeEVSE: return "NotAllowedTypeEVSE";
        case AuthorizationStatusEnumType_NotAtThisLocation: return "NotAtThisLocation";
        case AuthorizationStatusEnumType_NotAtThisTime: return "NotAtThisTime";
        case AuthorizationStatusEnumType_Unknown: return "Unknown";
    }
    return NULL;
}

/// @brief 3.4
/// @param string 
/// @return 
int AuthorizeCertificateStatusEnumType_fromString(const char *string)
{
    if (string)
    {
        if (strcmp(string, "Accepted")==0) return AuthorizeCertificateStatusEnumType_Accepted;
        if (strcmp(string, "SignatureError")==0) return AuthorizeCertificateStatusEnumType_SignatureError;
        if (strcmp(string, "CertificateExpired")==0) return AuthorizeCertificateStatusEnumType_CertificateExpired;
        if (strcmp(string, "CertificateRevoked")==0) return AuthorizeCertificateStatusEnumType_CertificateRevoked;
        if (strcmp(string, "NoCertificateAvailable")==0) return AuthorizeCertificateStatusEnumType_NoCertificateAvailable;
        if (strcmp(string, "CertChainError")==0) return AuthorizeCertificateStatusEnumType_CertChainError;
        if (strcmp(string, "ContractCancelled")==0) return AuthorizeCertificateStatusEnumType_ContractCancelled;

    }
    return 0;
}

const char* AuthorizeCertificateStatusEnumType_toString(AuthorizeCertificateStatusEnumType_t type)
{
    switch(type)
    {
        case AuthorizeCertificateStatusEnumType_Accepted: return "Accepted";
        case AuthorizeCertificateStatusEnumType_SignatureError: return "SignatureError";
        case AuthorizeCertificateStatusEnumType_CertificateExpired: return "CertificateExpired";
        case AuthorizeCertificateStatusEnumType_CertificateRevoked: return "CertificateRevoked";
        case AuthorizeCertificateStatusEnumType_NoCertificateAvailable: return "NoCertificateAvailable";
        case AuthorizeCertificateStatusEnumType_CertChainError: return "CertChainError";
        case AuthorizeCertificateStatusEnumType_ContractCancelled: return "ContractCancelled";
    }
    return NULL;
}

/// @brief 3.5
/// @param string 
/// @return 
int BatterySwapEventEnumType_fromString(const char *string)
{
    if (string)
    {
        if (strcmp(string, "BatteryIn")==0) return BatterySwapEventEnumType_BatteryIn;
        if (strcmp(string, "BatteryOut")==0) return BatterySwapEventEnumType_BatteryOut;
        if (strcmp(string, "BatteryOutTimeout")==0) return BatterySwapEventEnumType_BatteryOutTimeout;


    }
    return 0;
}

const char* BatterySwapEventEnumType_toString(BatterySwapEventEnumType_t type)
{
    switch(type)
    {
        case BatterySwapEventEnumType_BatteryIn: return "BatteryIn";
        case BatterySwapEventEnumType_BatteryOut: return "BatteryOut";
        case BatterySwapEventEnumType_BatteryOutTimeout: return "BatteryOutTimeout";
    }
    return NULL;
}