#ifndef DIDACTYL_NOSTR_BLOCK_LIST_H
#define DIDACTYL_NOSTR_BLOCK_LIST_H

#include "config.h"
#include "cjson/cJSON.h"
#include "../nostr_core_lib/nostr_core/nostr_signer.h"

int nostr_block_list_init(didactyl_config_t* cfg);
int nostr_block_list_load_from_relays(void);
void nostr_block_list_cleanup(void);

/* Wire a process-lifetime signer handle (non-owning) so NIP-44 encrypt/decrypt
 * of the private block-list content routes through the signer verbs in remote
 * signer modes. Falls back to the legacy raw-key path when NULL. The caller
 * must keep the signer alive for the module's lifetime and free it after
 * nostr_block_list_cleanup. */
void nostr_block_list_set_signer(nostr_signer_t* signer);

int nostr_block_list_is_pubkey_blocked(const char* pubkey_hex);
int nostr_block_list_is_event_blocked(const char* event_id_hex);
int nostr_block_list_is_hashtag_blocked(const char* hashtag);
int nostr_block_list_is_event_filtered(cJSON* event);

int nostr_block_list_add(const char* tag_key, const char* tag_value, int is_public);
int nostr_block_list_remove(const char* tag_key, const char* tag_value);
int nostr_block_list_refresh(void);

char* nostr_block_list_json(void);

#endif
