//! Tests for the Actor derive macro

use herolib_derive::Actor;

/// A simple test actor for process management.
#[derive(Actor)]
#[actor(name = "process_manager", version = "1.0.0")]
#[allow(dead_code)]
struct ProcessManager {
    name: String,
}

/// Test actor with default naming (struct name lowercase).
#[derive(Actor)]
struct SimpleActor;

#[test]
fn test_actor_name() {
    assert_eq!(ProcessManager::actor_name(), "process_manager");
}

#[test]
fn test_actor_version() {
    assert_eq!(ProcessManager::actor_version(), "1.0.0");
}

#[test]
fn test_actor_queue_key() {
    let key = ProcessManager::queue_key("main");
    assert_eq!(key, "actors:process_manager:main:queue");
}

#[test]
fn test_actor_result_key() {
    let key = ProcessManager::result_key("main", "req-123");
    assert_eq!(key, "actors:process_manager:main:result:req-123");
}

#[test]
fn test_actor_logs_key() {
    let key = ProcessManager::logs_key("main", "req-456");
    assert_eq!(key, "actors:process_manager:main:logs:req-456");
}

#[test]
fn test_default_actor_name() {
    // When no #[actor(name = "...")] is provided, uses struct name lowercased
    assert_eq!(SimpleActor::actor_name(), "simpleactor");
}

#[test]
fn test_default_actor_version() {
    // When no version is provided, uses CARGO_PKG_VERSION from Cargo.toml
    // The derive package version is currently "1.0.0"
    assert_eq!(SimpleActor::actor_version(), "1.0.0");
}

#[test]
fn test_simple_actor_queue_key() {
    let key = SimpleActor::queue_key("worker1");
    assert_eq!(key, "actors:simpleactor:worker1:queue");
}
