<?php

namespace App\Http\Controllers\Api\V1\Entrepreneur\Requests;

use Illuminate\Foundation\Http\FormRequest;

class VendorProductUpdateRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            // essentials...
            'name' => ['required', 'string', 'max:255'],
            'description' => ['nullable', 'string', 'max:255'],
            'new_imgs' => ['nullable'],
            'deleted_images' => ['nullable'],

            // prices...
            'cost_amount' => ['required', 'numeric'],
            'old_price_amount' => ['nullable', 'numeric', 'gt:cost_amount'],

            // relationships...
            'brand_id' => ['nullable', 'integer', 'exists:brands,id'],
            'category_ids' => ['required', 'array'],
            'collection_ids' => ['nullable', 'array'],

            // inventories...
            'stock' => ['required', 'integer', 'min:1'],
            'sku' => ['nullable', 'string', 'max:255'],
            'barcode' => ['nullable', 'string', 'max:255'],
        ];
    }
}
