<?php

namespace App\Http\Requests\Catalog;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'category_id' => ['nullable', 'uuid'],
            'sku' => ['nullable', 'string', 'max:255'],
            'name' => ['sometimes', 'string', 'max:255'],
            'description' => ['nullable', 'string'],
            'price' => ['sometimes', 'numeric', 'min:0'],
            'compare_price' => ['nullable', 'numeric', 'min:0'],
            'currency_code' => ['sometimes', 'string', 'size:3'],
            'status' => ['sometimes', 'string', 'in:active,inactive'],
            'stock_mode' => ['sometimes', 'string', 'in:tracked,untracked'],
            'stock_quantity' => ['sometimes', 'integer', 'min:0'],
            'availability_status' => ['sometimes', 'string', 'in:available,out_of_stock'],
        ];
    }
}
