<?php

namespace App\Http\Requests\Admin;

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

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

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules()
    {
        return [
            'current_password' => 'required|string|min:8',
            'new_password' => ['required', 'string', Password::min(6)->numbers()->mixedCase()->symbols()],
        ];
    }

    public function messages()
    {
        return [
            'password.min' => 'Password must be at least 6 characters long.',
            'password.numbers' => 'Password must include at least one number.',
            'password.mixed_case' => 'Password must include both uppercase and lowercase letters.',
            'password.symbols' => 'Password must include at least one special character.',

        ];
    }
}
