<?php

namespace App\Observers;

use App\Models\OrderRemark;

use App\Services\NotificationService;

class OrderRemarkObserver
{
    /**
     * Handle the OrderRemark "created" event.
     */
    public function created(OrderRemark $orderRemark): void
    {
        // Only notify user if message is from admin
        if ($orderRemark->is_admin) {
            $order = $orderRemark->order;
            NotificationService::send(
                $order->user_id,
                'New Message from Texora',
                "Our team sent you a new message regarding order #{$order->order_number}",
                "/dashboard/orders/{$order->id}",
                'info'
            );
        }
    }

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

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

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

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