#ifndef KMPARSEAPPDATA_H
#define KMPARSEAPPDATA_H

#include <gio/gio.h>
#include <glib.h>
#include <stdio.h>

#include <memory>
#include <string>
#include <unordered_map>
#include <vector>

#include "KMLogger.h"

typedef struct _Component
{
    char *id;
    GHashTable *names;
    GHashTable *comments;
    char *version;
    char *license;
    char *contentRatingType;
    GHashTable *contentRating; /* (element-type interned-utf8 ) */
} Component;

typedef struct _ParserData
{
    GPtrArray *components;
    GString *text;
    gboolean inText;
    gboolean inComponent;
    gboolean inContentRating;
    char *lang;
    guint64 timestamp;
    const char *id;
} ParserData;

bool parseAppdata(const char *appdata, const char *appDataId, GHashTable **names, GHashTable **comments, char **version, char **license, char **contentRatingType, GHashTable **contentRating);

#endif