<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Stancl\Tenancy\Database\Concerns\CentralConnection;

class SpecDocumentSection extends Model
{
    use CentralConnection;
    use HasFactory;

    protected $fillable = [
        'spec_document_id',
        'type',
        'title',
        'sort_order',
        'data',
        'completed_at',
        'completed_by',
    ];

    protected $casts = [
        'data' => 'array',
        'completed_at' => 'datetime',
    ];

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