<?php
namespace App\Models\Inventory;
use App\Models\User;
use App\Traits\BelongsToStore;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class StockMovement extends Model
{
    use BelongsToStore;
    protected $fillable = ['store_id','warehouse_id','movement_no','type','direction','items','related_order','status','operator_id','remark'];
    protected function casts(): array { return ['type'=>'integer','direction'=>'integer','items'=>'array','status'=>'integer']; }
    public function warehouse(): BelongsTo { return $this->belongsTo(Warehouse::class); }
    public function operator(): BelongsTo { return $this->belongsTo(User::class, 'operator_id'); }
}
