<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class QuoteRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'name'     => ['required', 'string', 'max:120'],
            'email'    => ['required', 'email:rfc', 'max:160'],
            'phone'    => ['nullable', 'string', 'max:40'],
            'company'  => ['required', 'string', 'max:160'],
            'country'  => ['nullable', 'string', 'max:80'],
            'service'  => ['required', 'string', 'max:60'],
            'budget'   => ['nullable', 'string', 'max:60'],
            'timeline' => ['nullable', 'string', 'max:60'],
            'message'  => ['required', 'string', 'min:10', 'max:4000'],
            'consent'  => ['accepted'],
            'website'  => ['prohibited'], // honeypot
        ];
    }

    public function messages(): array
    {
        return [
            'consent.accepted' => 'Please confirm you agree to our privacy policy.',
            'website.prohibited' => 'Your submission was flagged. Please try again.',
        ];
    }

    public function attributes(): array
    {
        return ['service' => 'service required'];
    }
}
