<?php

namespace App\Http\Requests\SelfPaced;

use Illuminate\Foundation\Http\FormRequest;

/**
 * StorePaymentProofRequest
 *
 * Validates payment proof file uploads (JPEG, PNG, PDF max 5MB).
 *
 * Requirements: 17.8
 */
class StorePaymentProofRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true; // Learner can upload their own proofs
    }

    public function rules(): array
    {
        return [
            'file' => ['required', 'file', 'mimes:jpeg,png,pdf', 'max:5120'],
            'proof_type' => ['required', 'string', 'in:mpesa,bank_slip,institution_receipt'],
            'fee_type' => ['required', 'string', 'in:enrollment,certificate,book,resit'],
        ];
    }

    public function messages(): array
    {
        return [
            'file.required' => 'Please upload a proof file',
            'file.mimes' => 'File must be JPEG, PNG, or PDF',
            'file.max' => 'File size must not exceed 5MB',
            'proof_type.required' => 'Please select proof type',
            'fee_type.required' => 'Please select fee type',
        ];
    }
}
