<?php

namespace App\Listeners;

use App\Events\ResetedPassword;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use IvanSotelo\TwilioVerify\Contracts\MustVerifyPhoneContract;

class SendPhoneResetNotification
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  ResetedPassword  $event
     * @return void
     */
    public function handle(ResetedPassword $event)
    {
        if ($event->user instanceof MustVerifyPhoneContract) {
            $event->user->sendPhoneVerificationNotification();
        }
    }
}
