<?php

namespace App\Models;

use CodeIgniter\Model;

class AttendanceCommentTemplateModel extends Model
{
    protected $table         = 'attendance_comment_template';
    protected $primaryKey    = 'id';
    protected $returnType    = 'array';
    protected $useTimestamps = false;
    protected $allowedFields = [
        'min_score',
        'max_score',
        'template_text',
        'is_active',
        'created_at',
        'updated_at',
    ];

    public function getActiveTemplates(): array
    {
        return $this->where('is_active', 1)
            ->orderBy('min_score', 'DESC')
            ->findAll();
    }
}
