<?php

namespace App\Http\Requests\Admin\Settings;

use Illuminate\Foundation\Http\FormRequest;

class UpdateSystemRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()->can('settings.update_system');
    }

    public function rules(): array
    {
        return [
            'app_name' => ['required', 'string', 'max:255'],
            'about_app' => ['nullable', 'string', 'max:2000'],
            'address' => ['nullable', 'string', 'max:500'],
            'email' => ['nullable', 'email', 'max:255'],
            'phone' => ['nullable', 'string', 'max:20'],
        ];
    }

    public function attributes(): array
    {
        return [
            'app_name' => 'nama aplikasi',
            'about_app' => 'tentang aplikasi',
            'address' => 'alamat',
            'email' => 'email',
            'phone' => 'nomor telepon',
        ];
    }
}
