<?php

namespace App\Http\Requests;

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

class ProductRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        $productId = $this->route('product')?->id;

        return [

            'category_id'=>'required|exists:categories,id',

            'product_name'=>'required|max:150',
 

            'description'=>'nullable',

            'price'=>'required|numeric|min:0',

            'discount_price'=>'nullable|numeric|min:0',

            'unit'=>'nullable|max:50',

            'display_order'=>'nullable|integer',

            'status'=>'required|boolean',

            'product_image'=>'nullable|image|mimes:jpg,jpeg,png,webp|max:2048',
            
            'stock_quantity' => 'required|integer|min:0',

        ];
    }
}