#ifndef DEVICE_CONFIG_H
#define DEVICE_CONFIG_H

// Device Types
#define DEVICE_ANCHOR 0
#define DEVICE_TAG 1

// Determine device type based on build flags
#if defined(DEVICE_TYPE_ANCHOR)
    #define DEVICE_TYPE DEVICE_ANCHOR
    #define DEVICE_IS_ANCHOR true
    #define DEVICE_IS_TAG false
    #define DEVICE_NAME "Anchor"
#elif defined(DEVICE_TYPE_TAG)
    #define DEVICE_TYPE DEVICE_TAG
    #define DEVICE_IS_ANCHOR false
    #define DEVICE_IS_TAG true
    #define DEVICE_NAME "Tag"
#else
    #error "Device type not specified. Use DEVICE_TYPE_ANCHOR or DEVICE_TYPE_TAG"
#endif

// Device Role Configurations
#if DEVICE_TYPE == DEVICE_ANCHOR
    #include "anchor_config.h"
#elif DEVICE_TYPE == DEVICE_TAG
    #include "tag_config.h"
#endif

// Common device behavior settings
struct DeviceConfig {
    int deviceId;
    bool isAnchor;
    const char* deviceName;
    int maxPeers;
    int capacityTags;
    int capacityTimeSlot;
    int capacityExtMode;
    const char* statusDisplayPrefix;
    const char* peerDisplayPrefix;
    const char* waitingMessage;
    const char* searchingMessage;
};

// Get current device configuration
inline DeviceConfig getDeviceConfig() {
    return {
        .deviceId = UWB_INDEX,
        .isAnchor = DEVICE_IS_ANCHOR,
        .deviceName = DEVICE_NAME,
        .maxPeers = MAX_PEER_DEVICES,
        .capacityTags = CAPACITY_TAGS,
        .capacityTimeSlot = CAPACITY_TIMESLOT,
        .capacityExtMode = CAPACITY_EXT_MODE,
        .statusDisplayPrefix = STATUS_PREFIX,
        .peerDisplayPrefix = PEER_PREFIX,
        .waitingMessage = WAITING_MESSAGE,
        .searchingMessage = SEARCHING_MESSAGE
    };
}

#endif // DEVICE_CONFIG_H