<?php

namespace App\Models\Qualitys;

use App\Models\Documents\Document;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class AuditStandardDocument extends Model
{
    protected $table = 'audit_standard_documents';

    protected $fillable = [
        'tenant_id',
        'checklist_item_id',
        'title',
        'version',
        'date',
        'document_id',
        'options',
    ];

    protected $casts = [
        'date' => 'date',
        'options' => 'array',
    ];

    public function checklistItem(): BelongsTo
    {
        return $this->belongsTo(AuditChecklistItem::class, 'checklist_item_id');
    }

    public function document(): BelongsTo
    {
        return $this->belongsTo(Document::class);
    }
}
