<?php

namespace App\Http\Requests\Backoffice;

use App\Support\Backoffice\Sanitizer\Traits\SanitizesInput;
use Illuminate\Foundation\Http\FormRequest;

class FolderCreateRequest extends FormRequest
{
    use SanitizesInput;

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'name' => 'required|string|max:255',
            'parent_id' => 'nullable|integer',
            'base_folder' => 'nullable|string',
        ];
    }

    /**
     * Filters to be applied to the input.
     *
     * @return array
     */
    public function filters(): array
    {
        return [
            'name' => "trim|strip_tags|xss_clean|folder_name_normalize",
            'base_folder' => "trim|strip_tags|xss_clean"
        ];
    }
}
