<?php

namespace App\Models\Documents;

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

/**
 * 템플릿별 검사 기준서 동적 필드 정의
 */
class DocumentTemplateSectionField extends Model
{
    protected $table = 'document_template_section_fields';

    protected $fillable = [
        'template_id',
        'field_key',
        'label',
        'field_type',
        'options',
        'width',
        'is_required',
        'sort_order',
    ];

    protected $casts = [
        'options' => 'array',
        'is_required' => 'boolean',
        'sort_order' => 'integer',
    ];

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