CREATE TABLE IF NOT EXISTS guest_profiles (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    managed_by_id TEXT NOT NULL,
    guest_user_id TEXT NOT NULL UNIQUE,
    status TEXT NOT NULL DEFAULT 'active' CHECK(status IN ('active', 'unlinked')),
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (managed_by_id) REFERENCES users(id) ON DELETE CASCADE,
    FOREIGN KEY (guest_user_id) REFERENCES users(id) ON DELETE CASCADE
);
