<?php

namespace Mtc\Modules\BlockRegistry\Models;

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

class BlockTemplateItem extends Model
{
    protected $table = 'block_template_items';

    protected $fillable = [
        'block_template_id',
        'block_id',
        'order_index',
    ];

    protected $casts = [
        'block_template_id' => 'integer',
        'block_id' => 'integer',
        'order_index' => 'integer',
    ];

    public function blockTemplate(): BelongsTo
    {
        return $this->belongsTo(BlockTemplate::class, 'block_template_id');
    }

    public function block(): BelongsTo
    {
        return $this->belongsTo(BlockRegistry::class, 'block_id');
    }
}
