<?php

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

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'name' => 'required|string|max:255',
            'type' => 'required|in:scoop,size',
            'is_required' => 'boolean',
            'min_select' => 'integer|min:0',
            'max_select' => 'integer|min:1',
            'is_active' => 'boolean',
            'items' => 'nullable|array',
            'items.*.name' => 'required_with:items|string|max:255',
            'items.*.price_modifier' => 'nullable|numeric',
            'items.*.is_default' => 'boolean',
            'items.*.sort_order' => 'integer|min:0',
            'items.*.is_active' => 'boolean',
        ];
    }
}
