<?php

namespace App\Http\Requests\Notification;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

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

    public function rules(): array
    {
        return [
            'tenant_id' => ['nullable', 'integer', 'exists:tenants,id'],
            'notification_event_id' => ['required', 'integer', 'exists:notification_events,id'],
            'notification_channel_id' => ['nullable', 'integer', 'exists:notification_channels,id'],
            'channel' => ['required', Rule::in(['system', 'whatsapp_official', 'whatsapp_unofficial', 'email', 'telegram'])],
            'name' => ['required', 'string', 'max:255'],
            'subject' => ['nullable', 'string', 'max:255'],
            'body' => ['required', 'string', 'max:20000'],
            'provider_template_name' => ['nullable', 'string', 'max:255'],
            'provider_template_id' => ['nullable', 'string', 'max:255'],
            'language' => ['nullable', 'string', 'max:10'],
            'approval_status' => ['nullable', Rule::in(['not_required', 'pending', 'approved', 'rejected'])],
            'enabled' => ['nullable', 'boolean'],
        ];
    }
}
