<?php

declare(strict_types=1);

namespace App\Models;

class LeadTechnicalProblem extends BaseModel
{
    protected string $table = 'lead_technical_problems';

    public function findByLeadId(int $leadId): array
    {
        return $this->query(
            "SELECT tp.*, u.name as created_by_name
             FROM {$this->table} tp
             LEFT JOIN users u ON tp.created_by = u.id
             WHERE tp.lead_id = :lead_id
             ORDER BY tp.created_at DESC",
            ['lead_id' => $leadId]
        );
    }
}
