<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'product_id' => ['nullable', 'exists:products,id'],
            'server_id' => ['nullable', 'exists:servers,id'],
            'domain' => ['nullable', 'string', 'max:255'],
            'quantity' => ['nullable', 'integer', 'min:1'],
            'billingcycle' => ['required', 'string'],
            'create_date' => ['nullable', 'date'],
            'next_due_date' => ['nullable', 'date'],
            'terminate_date' => ['nullable', 'date'],
            'status' => ['required', 'in:pending,active,suspended,terminated,cancelled'],
            'username' => ['nullable', 'string', 'max:255'],
            'password' => ['nullable', 'string', 'max:255'],
            'dedicated_ip' => ['nullable', 'ip'],
            'override_auto_suspend' => ['nullable', 'boolean'],
            'override_suspend_until' => ['nullable', 'date'],
            'notes' => ['nullable', 'string'],
        ];
    }
}
