<?php

declare(strict_types=1);

namespace App\Http\Requests\Collections;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'smart_rules_json' => ['required', 'array'],
            'smart_rules_json.match' => ['nullable', 'string'],
            'smart_rules_json.sort' => ['nullable', 'string'],
            'smart_rules_json.rules' => ['required', 'array'],
        ];
    }
}
