<?php

namespace App\Http\Requests\Teams;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Str;

class TeamUpdateRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }
    /**
     * @return void
     */
    protected function prepareForValidation(): void
    {
        $this->merge([
            'slug' => Str::slug($this->input('name')),
        ]);
    }
    /**
     * Get the validation rules that apply to the request.
     *
     * @return string[]
     */
    public function rules(): array
    {
        return [
            'slug' => ['nullable'],

            'name' => ['nullable', 'max:250'],

            'duty' => ['nullable', 'max:250'],

            'description' => ['nullable'],

            'image' => ['nullable', 'image', 'mimes:jpeg,png,jpg,gif,webp,svg'],
        ];
    }
}
