<?php

declare(strict_types=1);

namespace App\Http\Requests\ConversationAction;

use App\Enums\ConversationOfferStatus;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\Enum;

class UpdateOfferStatusRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user() !== null;
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'offer_status' => ['required', new Enum(ConversationOfferStatus::class)],
            'offer_amount' => ['nullable', 'numeric', 'min:0'],
            'offer_date' => ['nullable', 'date'],
            'note' => ['nullable', 'string', 'max:1000'],
        ];
    }
}
