<?php

namespace App\Http\Requests\Employee;

use App\Support\EmployeeValidation;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;

class StoreEmployeeRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    protected function prepareForValidation(): void
    {
        $this->merge(EmployeeValidation::normalize($this->all()));
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return EmployeeValidation::formRules(null, Auth::user()?->company_id, true);
    }

    /**
     * @return array<string, string>
     */
    public function messages(): array
    {
        return EmployeeValidation::messages();
    }
}
