<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class VanLoading extends Model
{
    protected $fillable = ['loading_no', 'van_session_id', 'source_warehouse_id', 'stock_transfer_id', 'loading_date', 'status', 'notes', 'requested_by', 'approved_by', 'approved_at'];
    protected $casts = ['loading_date' => 'date', 'approved_at' => 'datetime'];
    public function session() { return $this->belongsTo(VanSession::class, 'van_session_id'); }
    public function sourceWarehouse() { return $this->belongsTo(Warehouse::class, 'source_warehouse_id'); }
    public function transfer() { return $this->belongsTo(StockTransfer::class, 'stock_transfer_id'); }
    public function items() { return $this->hasMany(VanLoadingItem::class); }
}
