<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class OrderCourierShipmentLog extends Model
{
    use HasFactory;

    protected $guarded = [];

    protected $casts = [
        'success' => 'boolean',
        'request_payload' => 'array',
        'response_payload' => 'array',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];

    public function shipment()
    {
        return $this->belongsTo(OrderCourierShipment::class, 'order_courier_shipment_id');
    }

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

    public function triggeredByAdmin()
    {
        return $this->belongsTo(Admin::class, 'triggered_by_admin_id');
    }
}
