<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ProposalDocument extends Model
{
    protected $guarded = [];

    public function versions()
    {
        return $this->hasMany(ProposalVersion::class);
    }

    public function latestVersion()
    {
        return $this->hasOne(ProposalVersion::class)->latestOfMany();
    }

    public function opportunity()
    {
        return $this->belongsTo(Opportunity::class);
    }

    public function clientContact()
    {
        return $this->belongsTo(Contact::class, 'client_contact_id');
    }
}
