#ifndef __BETAUR_DEPENDENCY_H
#define __BETAUR_DEPENDENCY_H
#include <stddef.h>
#include <stdbool.h>

#include "aur/package.h"

typedef enum {
	BETAUR_ANY,
	BETAUR_EQ,
	BETAUR_GE,
	BETAUR_GT,
	BETAUR_LE,
	BETAUR_LT,
} betaur_mod;

typedef struct betaur_dependency {
	char* depstring;
	size_t name_len;
	char* name;
	size_t version_len;
	char* version;
	betaur_mod mod;
} betaur_dependency_t;

/*
 * Create a memory that should be destroyed by the caller
 * The returned struct is 'view' and does not create a memory for contents
 * The input string should not have leading or trailing white spaces
*/
betaur_dependency_t* betaur_dependency_create(size_t depstring_len, char* depstring);

bool betaur_satisfied_by_version(betaur_dependency_t* bdep, const char* version);

// TODO pass 'candidate' by reference as the parcel is huge
bool betaur_satisfied_by(betaur_package_t candidate);
#endif
