<?php

namespace App\Models\Documents;

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

/**
 * 문서 양식 결재라인 모델
 *
 * @property int $id
 * @property int $template_id
 * @property string $name 결재자 이름/직책
 * @property string|null $dept 부서
 * @property string $role 역할 (작성/검토/승인)
 * @property int $sort_order 정렬 순서
 */
class DocumentTemplateApprovalLine extends Model
{
    protected $table = 'document_template_approval_lines';

    protected $fillable = [
        'template_id',
        'name',
        'dept',
        'role',
        'sort_order',
    ];

    protected $casts = [
        'sort_order' => 'integer',
    ];

    public function template(): BelongsTo
    {
        return $this->belongsTo(DocumentTemplate::class, 'template_id');
    }
}
