#ifndef SHOPIFY_FUNCTION_H
#define SHOPIFY_FUNCTION_H
#include <stdint.h>
#include <stddef.h>
typedef int64_t Val;
typedef int32_t WriteResult;
typedef size_t InternedStringId;
#define WRITE_RESULT_OK 0
#define WRITE_RESULT_ERROR 1
#define SHOPIFY_FUNCTION_IMPORT_MODULE "shopify_function_v2"
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_input_get")))
extern Val shopify_function_input_get();
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_input_get_val_len")))
extern size_t shopify_function_input_get_val_len(Val scope);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_input_read_utf8_str")))
extern void shopify_function_input_read_utf8_str(size_t src, uint8_t* out, size_t len);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_input_get_obj_prop")))
extern Val shopify_function_input_get_obj_prop(Val scope, const uint8_t* ptr, size_t len);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_input_get_interned_obj_prop")))
extern Val shopify_function_input_get_interned_obj_prop(Val scope, InternedStringId interned_string_id);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_input_get_at_index")))
extern Val shopify_function_input_get_at_index(Val scope, size_t index);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_input_get_obj_key_at_index")))
extern Val shopify_function_input_get_obj_key_at_index(Val scope, size_t index);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_output_new_bool")))
extern WriteResult shopify_function_output_new_bool(uint32_t value);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_output_new_null")))
extern WriteResult shopify_function_output_new_null();
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_output_new_i32")))
extern WriteResult shopify_function_output_new_i32(int32_t value);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_output_new_f64")))
extern WriteResult shopify_function_output_new_f64(double value);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_output_new_utf8_str")))
extern WriteResult shopify_function_output_new_utf8_str(const uint8_t* ptr, size_t len);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_output_new_interned_utf8_str")))
extern WriteResult shopify_function_output_new_interned_utf8_str(InternedStringId id);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_output_new_object")))
extern WriteResult shopify_function_output_new_object(size_t len);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_output_finish_object")))
extern WriteResult shopify_function_output_finish_object();
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_output_new_array")))
extern WriteResult shopify_function_output_new_array(size_t len);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_output_finish_array")))
extern WriteResult shopify_function_output_finish_array();
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_intern_utf8_str")))
extern InternedStringId shopify_function_intern_utf8_str(const uint8_t* ptr, size_t len);
__attribute__((import_module(SHOPIFY_FUNCTION_IMPORT_MODULE)))
__attribute__((import_name("shopify_function_log_new_utf8_str")))
extern void shopify_function_log_new_utf8_str(const uint8_t* ptr, size_t len);
#endif