AeThex-Engine-Core/engine/modules/aethex_templates/template_data.h

153 lines
5.1 KiB
C++

/**************************************************************************/
/* template_data.h */
/**************************************************************************/
/* This file is part of: */
/* AETHEX ENGINE */
/* https://aethex.foundation */
/**************************************************************************/
/* Copyright (c) 2026-present AeThex Labs. */
/**************************************************************************/
#ifndef AETHEX_TEMPLATE_DATA_H
#define AETHEX_TEMPLATE_DATA_H
#include "core/io/resource.h"
#include "core/string/ustring.h"
#include "core/variant/dictionary.h"
// Represents a single project template from AeThex Studio
class AeThexTemplate : public Resource {
GDCLASS(AeThexTemplate, Resource);
public:
enum TemplateCategory {
CATEGORY_GAME,
CATEGORY_APPLICATION,
CATEGORY_TOOL,
CATEGORY_PLUGIN,
CATEGORY_COMPONENT,
CATEGORY_SNIPPET,
};
enum TargetPlatform {
PLATFORM_AETHEX = 1 << 0,
PLATFORM_ROBLOX = 1 << 1,
PLATFORM_UEFN = 1 << 2,
PLATFORM_UNITY = 1 << 3,
PLATFORM_WEB = 1 << 4,
PLATFORM_ALL = 0xFF,
};
enum Difficulty {
DIFFICULTY_BEGINNER,
DIFFICULTY_INTERMEDIATE,
DIFFICULTY_ADVANCED,
};
private:
String id;
String template_name;
String description;
String author;
String version;
String thumbnail_url;
String download_url;
TemplateCategory category = CATEGORY_GAME;
uint32_t platforms = PLATFORM_ALL;
Difficulty difficulty = DIFFICULTY_BEGINNER;
PackedStringArray tags;
PackedStringArray features;
PackedStringArray dependencies;
Dictionary variables; // Template variables for customization
Dictionary file_structure; // Files to create
bool is_builtin = false;
bool is_downloaded = false;
String local_path;
int64_t size_bytes = 0;
int rating = 0;
int downloads = 0;
protected:
static void _bind_methods();
public:
// Getters
String get_id() const { return id; }
String get_template_name() const { return template_name; }
String get_description() const { return description; }
String get_author() const { return author; }
String get_version() const { return version; }
String get_thumbnail_url() const { return thumbnail_url; }
String get_download_url() const { return download_url; }
TemplateCategory get_category() const { return category; }
uint32_t get_platforms() const { return platforms; }
Difficulty get_difficulty() const { return difficulty; }
PackedStringArray get_tags() const { return tags; }
PackedStringArray get_features() const { return features; }
PackedStringArray get_dependencies() const { return dependencies; }
Dictionary get_variables() const { return variables; }
Dictionary get_file_structure() const { return file_structure; }
bool get_is_builtin() const { return is_builtin; }
bool get_is_downloaded() const { return is_downloaded; }
String get_local_path() const { return local_path; }
int64_t get_size_bytes() const { return size_bytes; }
int get_rating() const { return rating; }
int get_downloads() const { return downloads; }
// Setters
void set_id(const String &p_id) { id = p_id; }
void set_template_name(const String &p_name) { template_name = p_name; }
void set_description(const String &p_desc) { description = p_desc; }
void set_author(const String &p_author) { author = p_author; }
void set_version(const String &p_version) { version = p_version; }
void set_thumbnail_url(const String &p_url) { thumbnail_url = p_url; }
void set_download_url(const String &p_url) { download_url = p_url; }
void set_category(TemplateCategory p_cat) { category = p_cat; }
void set_platforms(uint32_t p_platforms) { platforms = p_platforms; }
void set_difficulty(Difficulty p_diff) { difficulty = p_diff; }
void set_tags(const PackedStringArray &p_tags) { tags = p_tags; }
void set_features(const PackedStringArray &p_features) { features = p_features; }
void set_dependencies(const PackedStringArray &p_deps) { dependencies = p_deps; }
void set_variables(const Dictionary &p_vars) { variables = p_vars; }
void set_file_structure(const Dictionary &p_struct) { file_structure = p_struct; }
void set_is_builtin(bool p_builtin) { is_builtin = p_builtin; }
void set_is_downloaded(bool p_downloaded) { is_downloaded = p_downloaded; }
void set_local_path(const String &p_path) { local_path = p_path; }
void set_size_bytes(int64_t p_size) { size_bytes = p_size; }
void set_rating(int p_rating) { rating = p_rating; }
void set_downloads(int p_downloads) { downloads = p_downloads; }
// Utility
bool supports_platform(TargetPlatform p_platform) const;
String get_category_name() const;
String get_difficulty_name() const;
String get_size_string() const;
// Serialization
Dictionary to_json() const;
static Ref<AeThexTemplate> from_json(const Dictionary &p_data);
AeThexTemplate();
~AeThexTemplate();
};
VARIANT_ENUM_CAST(AeThexTemplate::TemplateCategory);
VARIANT_ENUM_CAST(AeThexTemplate::TargetPlatform);
VARIANT_ENUM_CAST(AeThexTemplate::Difficulty);
#endif // AETHEX_TEMPLATE_DATA_H