<?php

namespace App\Http\Requests\Admin;

use App\Models\AiStaffProfile;
use Illuminate\Foundation\Http\FormRequest;

class AiStaffProfileStoreRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return $this->user()->can('create', AiStaffProfile::class);
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'name' => 'required|string|max:255',
            'email' => 'nullable|string|email|max:255',
            'job_title' => 'nullable|string|max:255',
            'system_prompt' => 'nullable|string',
            'personality_tone' => 'required|in:formal,friendly,neutral,professional,casual,empathetic,technical',
            'humanize_enabled' => 'boolean',
            'typo_frequency' => 'nullable|numeric|min:0|max:100',
            'confidence_threshold' => 'required|numeric|min:0|max:100',
            'response_delay_min' => 'required|integer|min:0|max:60',
            'response_delay_max' => 'required|integer|min:1|max:120',
            'working_hours_start' => 'nullable|date_format:H:i',
            'working_hours_end' => 'nullable|date_format:H:i',
            'working_days' => 'nullable|array',
            'working_days.*' => 'integer|min:1|max:7',
            'timezone' => 'nullable|string|max:50',
            'waiting_message_enabled' => 'boolean',
            'waiting_message_text' => 'nullable|string',
            'max_autonomous_replies_per_ticket' => 'required|integer|min:1|max:50',
            'status' => 'required|in:active,paused,training',
        ];
    }
}
