<?php

namespace App\Http\Requests;

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

class WatchlistRequest extends FormRequest
{
    use SanitizesInput;

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'name' => 'required|string|max:150',
            'type' => 'nullable|string|in:competitions,results,tracked_results,company_profiles,jobs',
        ];
    }

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