<?php

namespace App\Http\Requests\Store;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'product_id' => ['nullable', 'integer', 'exists:products,id'],
            'quantity' => ['nullable', 'integer', 'min:1'],
            'period' => ['nullable', 'integer', 'min:1'],
            'time' => ['nullable', 'string'],
            'domain_action' => ['nullable', 'in:register,transfer,use,renew'],
            'domain_name' => ['nullable', 'string'],
            'client_domain_id' => ['nullable', 'integer', 'exists:client_domains,id'],
            'epp_code' => ['nullable', 'string'],
            'config_options' => ['nullable', 'string'],
            'custom_fields' => ['nullable', 'string'],
            'is_premium' => ['nullable', 'boolean'],
            // PRC-644 — kabul edilir ama OTORİTER DEĞİL; backend premium fiyatı sunucuda yeniden hesaplar.
            'premium_pricing' => ['nullable', 'array'],
            'premium_price' => ['nullable', 'numeric', 'min:0'],
            'is_trial' => ['nullable', 'boolean'],
            'post_trial_period' => ['nullable', 'string'],
        ];
    }
}
