<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class MachineryRequest extends FormRequest
{
    public function authorize()
    {
        return auth()->check();
    }

    public function rules()
    {
        return [
            'company_id' => 'nullable|exists:companies,id',
            'name' => 'required|string|max:255',
            'type' => 'nullable|string|max:255',
            'purchase_date' => 'nullable|date',
            'hourly_rate' => 'nullable|numeric|min:0',
        ];
    }
}