* @author Maximum Software Inc * @license GPL-3.0-only * @link https://agenistrator.com/ * * SPDX-FileCopyrightText: 2025-2026 Alex Ruban * SPDX-FileCopyrightText: 2025-2026 Maximum Software Inc * SPDX-License-Identifier: GPL-3.0-only */ namespace Agenistrator; // Direct access prevention if ( ! defined( 'ABSPATH' ) ) { exit; } /** * User_Message class. */ class User_Message extends Message { /** * Get the message role * * @return string The message role * @since 1.0.0 */ public function get_role() { return 'user'; } /** * Create User_Message instance from array data * * @param array $data Message data array * @return User_Message|null Message instance or null if invalid * @since 1.0.0 */ public static function from_array( $data ) { // User messages require content if ( ! isset( $data['content'] ) || null === $data['content'] ) { return null; } return new self( $data['content'], $data['metadata'] ?? null, $data['timestamp'] ?? time(), $data['message_id'] ?? null ); } }