<?php
namespace App\Models;

class PaymentRepository extends BaseRepository {
    public function pendingForStudent(int $studentId): array {
        return $this->fetchAll("SELECT * FROM payments WHERE student_id = ? AND status IN ('pending','awaiting_proof','rejected') ORDER BY created_at DESC", [$studentId]);
    }

    public function awaitingReview(): array {
        return $this->fetchAll("SELECT p.*, s.student_number, u.first_name, u.last_name FROM payments p JOIN students s ON p.student_id = s.id JOIN users u ON s.user_id = u.id WHERE p.status = 'submitted' ORDER BY p.created_at");
    }
}
