<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StoreJobApplicationRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true; // Allow authenticated users
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'job_post_id' => 'required|integer|exists:job_posts,id',
            'first_name' => 'required|string|max:255',
            'last_name' => 'required|string|max:255',
            'email' => 'required|email|max:255',
            'phone' => 'required|string|max:20',
            'resume' => 'required|file|mimes:pdf,doc,docx|max:5248', // 5MB max
            'cover_letter' => 'nullable|string|max:5000',
            'experience_level' => 'required|string|max:100',
            'available_date' => 'nullable|date',
            'notice_period' => 'nullable|string|max:100',
            'salary_expectation' => 'nullable|integer|min:0',
            'remote_interested' => 'nullable|boolean',
            'additional_answers' => 'nullable|array',
            'consent_data' => 'required|boolean|accepted',
            'consent_marketing' => 'nullable|boolean',
        ];
    }
}
