<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class FormTemplate extends Model
{
    use HasUuids, HasFactory;

    protected $guarded = [];

    protected $casts = [
        'is_active' => 'boolean',
    ];

    public function fields()
    {
        return $this->hasMany(FormField::class, 'template_id')->orderBy('display_order');
    }

    public function printLogs()
    {
        return $this->hasMany(FormPrintLog::class, 'template_id');
    }
}
