<?php

namespace App\Models\StockManagement;

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

class StockRequest extends Model{
    use HasFactory,Statuable,AuthorableTrait;

    protected $table = "stock_mgt__stock_requests";
    protected $guarded = ["id",'created'];

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

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