<?php

declare(strict_types=1);

namespace App\Http\Requests\ConversationAction;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

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

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'outcome' => ['required', 'string', Rule::in(['deal_closed', 'deal_cancelled'])],
            'reason' => ['nullable', 'string', 'max:500'],
        ];
    }
}
