<?php

namespace App\Http\Requests\INSURANCE;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class UpdateInsurerRequest extends FormRequest
{

    public function rules(): array
    {
        $insurer = $this->route('insurer');

        return [
            'business_name' => 'required|string|max:255',
            'short_name'    => 'required|string|max:255',
            'mb'            => 'required|string|max:255',
            'pib'           => 'required|string|max:255',
            'email'      => ['required', 'email', Rule::unique('insurers', 'email')->ignore($insurer->id)],
            'mobile'     => 'nullable|string|max:255',
            'phone'      => 'nullable|string|max:255',
        ];
    }
}
