<?php

namespace App\Http\Requests\Admin\BlogCategory;

use App\Http\Requests\BaseRequest;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class CreateBlogCategoryRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'name' => 'required|string|max:255|unique:blog_categories,name',
            'image_url' => 'nullable|url|max:500',
            'description' => 'nullable|string|max:1000',
            'status' => 'nullable|boolean',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => 'Category name is required.',
            'name.unique' => 'This category name already exists.',
            'image_url.url' => 'Image URL must be a valid URL.',
            'description.max' => 'Description cannot exceed 1000 characters.',
        ];
    }
}
