<?php

namespace App\Http\Requests\Api\V1\Product;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'category_id' => 'required|exists:categories,id',
            'name' => 'required|string|max:255',
            'slug' => 'nullable|string|max:255|unique:products,slug',
            'description' => 'nullable|string',
            'base_price' => 'nullable|numeric|min:0',
            'scoop_price' => 'nullable|numeric|min:0',
            'image' => 'nullable|string|max:255',
            'max_scoops' => 'nullable|integer|min:0',
            'is_active' => 'boolean',
            'requires_production' => 'boolean',
            'option_set_ids' => 'nullable|array',
            'option_set_ids.*' => 'exists:option_sets,id',
            'inner_option_set_ids' => 'nullable|array',
            'inner_option_set_ids.*' => 'exists:inner_option_sets,id',
        ];
    }
}
