<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class UpdateBusinessSettingsRequest 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(): array
    {
        return [
            'currency_symbol' => 'required|string|max:5',
            'timezone' => 'required|timezone',
            'country' => 'required|string|max:100',
            'language' => 'required|string|in:en,ar',
        ];
    }

    /**
     * Get custom messages for validator errors.
     *
     * @return array<string, string>
     */
    public function messages(): array
    {
        return [
            'currency_symbol.required' => 'Currency symbol is required.',
            'currency_symbol.max' => 'Currency symbol must not exceed 5 characters.',
            'timezone.required' => 'Timezone is required.',
            'timezone.timezone' => 'Please select a valid timezone.',
            'country.required' => 'Country is required.',
            'country.max' => 'Country name must not exceed 100 characters.',
            'language.required' => 'Language is required.',
            'language.in' => 'Selected language is invalid.',
        ];
    }
}
