<?php

namespace App\Http\Requests\Notifications;

use App\Http\Requests\ApiFormRequest;

class NotificationSendRequest extends ApiFormRequest
{
    public function authorize(): bool
    {
        return $this->user() !== null;
    }

    public function rules(): array
    {
        return [
            'title' => ['required', 'string', 'max:150'],
            'message' => ['required', 'string', 'max:5000'],
            'target_group' => ['required', 'string', 'max:50'],
            'channels' => ['required', 'array'],
            'channels.*' => ['string', 'in:in_app,email,sms'],
            'priority' => ['nullable', 'string', 'max:20'],
            'status' => ['nullable', 'string', 'max:20'],
            'action_url' => ['nullable', 'string', 'max:255'],
            'attachment_path' => ['nullable', 'string', 'max:255'],
            'scheduled_at' => ['nullable', 'date'],
            'expires_at' => ['nullable', 'date', 'after_or_equal:scheduled_at'],
            'school_year' => ['nullable', 'string', 'max:20'],
            'semester' => ['nullable', 'string', 'max:20'],
        ];
    }
}
