<?php

namespace App\Models;

use CodeIgniter\Model;

class ReportPhotoModel extends Model
{
    protected $table = 'report_photos';
    protected $primaryKey = 'id';
    protected $returnType = 'array';
    protected $useAutoIncrement = true;
    protected $protectFields = true;
    protected $allowedFields = [
        'report_id', 'section', 'caption', 'file_path', 'mime', 'size', 'orden', 'created_at',
    ];
    protected $useTimestamps = false;

    public function forReport(int $reportId): array
    {
        return $this->where('report_id', $reportId)
            ->orderBy('section')
            ->orderBy('orden')
            ->orderBy('id')
            ->findAll();
    }
}
