<?php

namespace Kylin\LawCase\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 文档审批模型
 *
 * 管理文档审批流程，包括审批人、审批状态、审批意见等。
 *
 * @property string $status   审批状态
 * @property string $comment  审批意见
 */
class DocumentApproval extends Model
{
    protected $table = 'kylin_law_document_approvals';

    protected $fillable = [
        'document_id',
        'approver_id',
        'status',
        'comment',
        'approved_at',
    ];

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

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

    public function approver()
    {
        return $this->belongsTo(\App\Models\User::class, 'approver_id');
    }
}
