<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class DeliveryPickupStop extends Model
{
    protected $fillable = [
        'delivery_assignment_id', 'vendor_id', 'sequence',
        'status', 'arrived_at', 'picked_up_at',
    ];

    protected function casts(): array
    {
        return [
            'arrived_at'   => 'datetime',
            'picked_up_at' => 'datetime',
        ];
    }

    public function assignment(): BelongsTo
    {
        return $this->belongsTo(DeliveryAssignment::class, 'delivery_assignment_id');
    }

    public function vendor(): BelongsTo
    {
        return $this->belongsTo(Vendor::class);
    }
}
