<?php

namespace App\EventHooks\Order;

use App\EventHooks\HookEvent;
use App\Models\Order;

/**
 * Fire noktası: FraudDetectionService::runChecks → status 'review' → FraudCheckAwaitingUserInput
 * (buildOrderContext + ['fraud_status','fraud_score'] extra; commit SONRASI).
 * Context: order (model), order_id/orderid, fraud_status, fraud_score.
 */
class FraudCheckAwaitingInput extends HookEvent
{
    public const HOOK = 'FraudCheckAwaitingUserInput';

    public function order(): ?Order
    {
        $o = $this->get('order');
        if ($o instanceof Order) {
            return $o;
        }
        $id = $this->get('order_id') ?? $this->get('orderid');

        return $id ? Order::find($id) : null;
    }

    public function fraudScore(): mixed
    {
        return $this->get('fraud_score');
    }
}
