#ifndef LASERTAG_UTILS_H
#define LASERTAG_UTILS_H

#include <stdint.h>

/**
 * @file lasertag_utils.h
 * @brief Common utility functions for the lasertag system.
 */

/**
 * @brief Initialize the common lasertag utilities (NVS, Shell, etc.).
 */
void lasertag_utils_init(void);

/**
 * @brief Get the current device name.
 * @return Pointer to the device name string.
 */
const char* lasertag_get_device_name(void);

/**
 * @brief Get the configured Thread PAN ID.
 * @return 16-bit PAN ID.
 */
uint16_t lasertag_get_thread_pan_id(void);

/**
 * @brief Get the configured Thread Network Name.
 * @return Pointer to the network name string.
 */
const char* lasertag_get_thread_network_name(void);

/**
 * @brief Get the configured Thread Channel.
 * @return 8-bit channel (usually 11-26).
 */
uint8_t lasertag_get_thread_channel(void);

/**
 * @brief Get the configured Thread Extended PAN ID.
 * @return Pointer to the 8-byte extended PAN ID.
 */
const uint8_t* lasertag_get_thread_ext_pan_id(void);

/**
 * @brief Get the configured Thread Network Key.
 * @return Pointer to the 16-byte network key.
 */
const uint8_t* lasertag_get_thread_network_key(void);

/**
 * @brief Set the device name.
 * @param name Pointer to the name string.
 * @param len Length of the name.
 * @return 0 on success, negative error code otherwise.
 */
int lasertag_set_device_name(const char *name, size_t len);

/**
 * @brief Set the Thread PAN ID.
 * @param pan_id 16-bit PAN ID.
 * @return 0 on success, negative error code otherwise.
 */
int lasertag_set_thread_pan_id(uint16_t pan_id);

/**
 * @brief Set the Thread Network Name.
 * @param name Pointer to the network name string.
 * @param len Length of the name.
 * @return 0 on success, negative error code otherwise.
 */
int lasertag_set_thread_network_name(const char *name, size_t len);

/**
 * @brief Set the Thread Channel.
 * @param channel 8-bit channel (usually 11-26).
 * @return 0 on success, negative error code otherwise.
 */
int lasertag_set_thread_channel(uint8_t channel);

/**
 * @brief Set the Thread Extended PAN ID.
 * @param ext_id Pointer to the 8-byte extended PAN ID.
 * @return 0 on success, negative error code otherwise.
 */
int lasertag_set_thread_ext_pan_id(const uint8_t *ext_id);

/**
 * @brief Set the Thread Network Key.
 * @param key Pointer to the 16-byte network key.
 * @return 0 on success, negative error code otherwise.
 */
int lasertag_set_thread_network_key(const uint8_t *key);

#endif /* LASERTAG_UTILS_H */