<?php

namespace App\Models;

# use Illuminate\Database\Eloquent\Model;

class SupplyOrder extends Model
{
    protected $table = 'supply_order';

    public function getRouteKeyName()
    {
        return 'uid';
    }

    public function client()
    {
        return $this->hasOne(Client::class, 'id', 'client_id');
    }

    public function product()
    {
        return $this->hasOne(Product::class, 'id', 'product_id');
    }

    public function shipment()
    {
        return $this->hasOne(Shipment::class, 'id', 'shipment_id');
    }

    public function signedPro() {
        return $this->hasOne(Pro::class, 'id', 'signed_by_pro_id');
    }

    public function waiverPro() {
        return $this->hasOne(Pro::class, 'id', 'client_signature_waived_by_pro_id');
    }

    public function clearedForShipmentPro() {
        return $this->hasOne(Pro::class, 'id', 'cleared_for_shipment_by_pro_id');
    }

    public function createdSession()
    {
        return $this->hasOne(AppSession::class, 'id', 'created_by_session_id');
    }
}
