<?php

namespace App\Http\Requests\System;

use App\Http\Requests\ApiFormRequest;

class NavItemStoreRequest extends ApiFormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'id' => ['nullable', 'integer', 'min:1', 'exists:nav_items,id'],
            'menu_parent_id' => ['nullable', 'integer', 'min:1', 'exists:nav_items,id'],
            'parent_id' => ['nullable', 'integer', 'min:1', 'exists:nav_items,id'],
            'label' => ['required', 'string', 'max:255'],
            'url' => ['nullable', 'string', 'max:255'],
            'icon_class' => ['nullable', 'string', 'max:255'],
            'target' => ['nullable', 'string', 'max:50'],
            'sort_order' => ['nullable', 'integer'],
            'is_enabled' => ['nullable', 'boolean'],
            'roles' => ['nullable', 'array'],
            'roles.*' => ['integer', 'min:1', 'exists:roles,id'],
        ];
    }
}
