<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class OperationalDocument extends Model
{
    use SoftDeletes;

    protected $fillable = ['business_id','type','reference_number','account_id','contact_id','deal_id','project_id','owner_id','status','details','parent_id','trade_document_id','approved_at','approved_by'];
    protected $casts = ['details' => 'array', 'approved_at' => 'datetime'];
    public function parent() { return $this->belongsTo(self::class, 'parent_id'); }
    public function histories() { return $this->hasMany(OperationalDocumentHistory::class); }
}
