<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ServiceTypeRequest extends FormRequest
{
    public function rules(): array
    {
        $rules = [
            'description' => 'sometimes|string|max:255',
            'is_active'   => 'sometimes|boolean',
        ];

        if ($this->isMethod('POST')) {
            $rules['description'] = 'required|string|max:255';
        }

        return $rules;
    }

    /**
    * Add custom messages when needed
    * public function messages(): array
    * {
    *   return [
    *        'field.required' => __('message.algo'),
    *    ];
    * }
    */
}
