<?php

namespace App\Observers;

use App\Jobs\SendApprover1MailJob;
use App\Models\RequestCharacteristic;
use App\Models\CharacteristicApproverMaster;
use App\Mail\CharacteristicApprovalMail;
use Illuminate\Support\Facades\Mail;

class RequestCharacteristicObserver
{
    /**
     * Handle the RequestCharacteristic "created" event.
     */
    public function created(RequestCharacteristic $request): void
    {
         // Only if all statuses are NULL
        if (
            !is_null($request->approver_status1) ||
            !is_null($request->approver_status2) ||
            !is_null($request->approver_status3)
        ) {
            return;
        }

        SendApprover1MailJob::dispatch($request);
    }

    /**
     * Handle the RequestCharacteristic "updated" event.
     */
    public function updated(RequestCharacteristic $requestCharacteristic): void
    {
        //
    }

    /**
     * Handle the RequestCharacteristic "deleted" event.
     */
    public function deleted(RequestCharacteristic $requestCharacteristic): void
    {
        //
    }

    /**
     * Handle the RequestCharacteristic "restored" event.
     */
    public function restored(RequestCharacteristic $requestCharacteristic): void
    {
        //
    }

    /**
     * Handle the RequestCharacteristic "force deleted" event.
     */
    public function forceDeleted(RequestCharacteristic $requestCharacteristic): void
    {
        //
    }
}
