<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

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

    protected function casts(): array
    {
        return [
            'request_payload' => 'array',
            'response_payload' => 'array',
            'completed_at' => 'datetime',
            'failed_at' => 'datetime',
        ];
    }

    public function orderItem()
    {
        return $this->belongsTo(OrderItem::class);
    }

    public function providerModel()
    {
        return $this->belongsTo(Provider::class, 'provider_id');
    }
}
