
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "preemption_vulnerability.h"

char* OpenAPI_preemption_vulnerability_ToString(OpenAPI_preemption_vulnerability_e preemption_vulnerability)
{
    const char *preemption_vulnerabilityArray[] =  { "NULL", "NOT_PREEMPTABLE", "PREEMPTABLE" };
    size_t sizeofArray = sizeof(preemption_vulnerabilityArray) / sizeof(preemption_vulnerabilityArray[0]);
    if (preemption_vulnerability < sizeofArray)
        return (char *)preemption_vulnerabilityArray[preemption_vulnerability];
    else
        return (char *)"Unknown";
}

OpenAPI_preemption_vulnerability_e OpenAPI_preemption_vulnerability_FromString(char* preemption_vulnerability)
{
    int stringToReturn = 0;
    const char *preemption_vulnerabilityArray[] =  { "NULL", "NOT_PREEMPTABLE", "PREEMPTABLE" };
    size_t sizeofArray = sizeof(preemption_vulnerabilityArray) / sizeof(preemption_vulnerabilityArray[0]);
    while (stringToReturn < sizeofArray) {
        if (strcmp(preemption_vulnerability, preemption_vulnerabilityArray[stringToReturn]) == 0) {
            return stringToReturn;
        }
        stringToReturn++;
    }
    return 0;
}

