<?php

declare(strict_types=1);

namespace App\Http\Requests\Blog;

use App\Models\Faq;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

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

  public function rules(): array
  {
    return [
      'model_type' => ['sometimes', 'required', 'string', 'max:255'],
      'model_id' => ['sometimes', 'required', 'integer', 'min:1'],
      'question' => ['sometimes', 'required', 'string', 'min:3', 'max:5000'],
      'response' => ['nullable', 'string', 'max:10000'],
      'order' => ['nullable', 'integer', 'min:0'],
      'status' => ['nullable', 'string', Rule::in([
        Faq::STATUS_PENDING,
        Faq::STATUS_APPROVED,
        Faq::STATUS_REJECTED,
      ])],
    ];
  }
}
