<?php

namespace App\Models\StockManagement;

use App\Models\StockManagement\Bootables\Statuable;
use App\Models\StockManagement\Traits\CanAdjustStock;
use Axn\EloquentAuthorable\AuthorableTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class StockRequestItem extends Model{
    use CanAdjustStock;

    protected $table = "stock_mgt__stock_requests_items";
    protected $guarded = ["id"];

    /** L'entrepot qui a émi la demande (qui veut se ravitailler)
     * @return BelongsTo
     */
    public function stock(){
        return $this->belongsTo(Stock::class,"stock_id");
    }

    /** L'entrepot qui a reçue la demande (le stock sera debité)
     * @return BelongsTo
     */
    public function product(){
        return $this->belongsTo(Warehouse::class,"receiver_warehouse_id");
    }
}
