<?php

namespace App\Models;

use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;

class ApplicationDelivery extends Model
{
    use BelongsToTenant;

    protected $fillable = [
        'tenant_id', 'application_id', 'delivery_method', 'recipient_name', 'recipient_mobile',
        'identification_type', 'identification_reference', 'acknowledgement', 'delivered_by', 'delivered_at',
    ];

    protected $casts = ['delivered_at' => 'datetime'];

    public function application()
    {
        return $this->belongsTo(Application::class);
    }

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