<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class NovaCardTemplate extends Model
{
    use HasFactory, SoftDeletes;

    protected $fillable = [
        'slug',
        'name',
        'description',
        'preview_image',
        'config_json',
        'supported_formats',
        'active',
        'official',
        'order_num',
    ];

    protected $casts = [
        'config_json' => 'array',
        'supported_formats' => 'array',
        'active' => 'boolean',
        'official' => 'boolean',
        'order_num' => 'integer',
    ];

    public function cards(): HasMany
    {
        return $this->hasMany(NovaCard::class, 'template_id');
    }
}
