System: You are a rock-star php developer.
User: Consider the following declarations:

```php
<?php

namespace App\Livewire;

use Livewire\Component;
use Livewire\WithPagination;

class Messages extends Component
{
  public function render()
  {
    return view('livewire.dashboard.admin.send-message-content');
  }
}

```


```php
<?php

namespace App\Enums;

enum QueueMessageType: string
{
    case Commercial = 'Commercial';
    case Information = 'Information';
    case Authentication = 'Authentication';
}

```


```php
<?php

namespace App\Enums;

enum AuthenticationStatus: string
{
  case Unauthenticated = 'unauthenticated';
  case Authenticated = 'authenticated';
  case NotProcessed = 'not_processed';
  case InProgress = 'in_progress';
}

```


What do you think, should something be inserted instead of <INSERT_CODE_HERE> in the document below or the document is already ok?

* If some code should be inserted then answer with new code to insert at the position <INSERT_CODE_HERE>.
* Don't generate any other text or explanation.
* Use comments and surrounding code to predic what is necessary instead of <INSERT_CODE_HERE>.
* You can generate oneline of code or multiple lines

Answer in the format:
CODE_TO_INSERT:
```php
<code>
```

Here is the original code:
```php
<?php

namespace App\Livewire;

use App\Enums\QueueMessageStatus;
use App\Models\QueueMessage;
use App\Models\User;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
use Livewire\Component;
use App\Enums\QueueMessageType;

class Messages extends Component
{
  public $message;
  public $messageType = 'Commercial';
  public $userGroup = 'all';

  /**
   * Sends a message to a group of users based on the specified criteria.
   *
   * This method validates the input data, maps the message type to a corresponding
   * enum, retrieves the requested users, and prepares the messages for insertion
   * into the database. Finally, it dispatches an event indicating that the message
   * has been sent.
   *
   * @return void
   *
   * @throws ValidationException If the validation fails.
   */
  public function sendMessage(): void<INSERT_CODE_HERE>
  {
    $validatedData = Validator::make([
      'message' => $this->message,
      'messageType' => $this->messageType,
      'userGroup' => $this->userGroup,
    ], [
      'message' => 'required|string|max:255',
      'messageType' => 'required|in:Commercial,Informational',
      'userGroup' => 'required|in:all,authenticated,unauthenticated,in_progress,premium',
    ])->validate();

    // Map messageType to QueueMessageType enum
    $messageType = QueueMessageType::tryFrom($validatedData['messageType']);

    $users = $this->getRequestedUsers();
    $messages = $users->map(function (User $user) use ($messageType) {
      return [
        'message' => $this->message,
        'user_id' => $user->id,
        'type' => $messageType,
        'status' => QueueMessageStatus::Pending,
      ];
    })->toArray();

    QueueMessage::insert($messages);

    $this->message = '';
    $this->dispatch('messageSent');
  }

  private function getRequestedUsers(): Collection
  {
    if ($this->userGroup === 'all') {
      return User::all();
    }
    return User::where('authentication_status', $this->userGroup)->get();
  }

  public function render()
  {
    return view('livewire.dashboard.admin.send-message-content');
  }
}

```
Assistant: