<?php

namespace Modules\Vrc\Entities;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class VrcDocument extends Model
{
    protected $table = 'vrc_documents';

    protected $fillable = [
        'business_id', 'code', 'title', 'category', 'version', 'status', 'file_path',
        'content', 'owner_id', 'approved_by', 'approved_at', 'review_due',
    ];

    protected $casts = [
        'approved_at' => 'datetime',
        'review_due'  => 'date',
    ];

    public const STATUSES = ['draft', 'under_review', 'approved', 'obsolete'];

    public function acknowledgements(): HasMany
    {
        return $this->hasMany(VrcDocumentAcknowledgement::class, 'document_id');
    }
}
