<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ManualPaymentSubmission extends Model
{
    protected $guarded = [];

    protected function casts(): array
    {
        return [
            'reviewed_at' => 'datetime',
            'additional_info_requested_at' => 'datetime',
            'expires_at' => 'datetime',
            'dynamic_fields' => 'array',
            'risk_flags' => 'array',
            'amount_minor' => 'integer',
            'risk_score' => 'integer',
        ];
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function gateway()
    {
        return $this->belongsTo(ManualPaymentGateway::class, 'manual_payment_gateway_id');
    }

    public function order()
    {
        return $this->belongsTo(Order::class);
    }

    public function reviewer()
    {
        return $this->belongsTo(User::class, 'reviewed_by');
    }
}
