<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\Password;

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

    /**
     * Single-step install: DB + license (purchase_code, client_name) + admin user.
     */
    public function rules(): array
    {
        return [
            'host' => 'required',
            'db_user' => 'required',
            'db_name' => 'required',
            'db_password' => 'nullable',
            'first_name' => 'required',
            'last_name' => 'required',
            'email' => 'required|email',
            'password' => ['required', Password::defaults()],
            'purchase_code' => 'nullable',
            'client_name' => 'nullable',
        ];
    }
}
