<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\ApiFormRequest;

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

    public function rules(): array
    {
        return [
            'slug' => ['required', 'string', 'max:64', 'regex:/^[a-z0-9_\\-]+$/', 'unique:admin_roles,slug'],
            'name' => ['required', 'string', 'max:128'],
            'description' => ['nullable', 'string', 'max:65535'],
            'status' => ['sometimes', 'integer', 'in:0,1'],
            'permission_slugs' => ['sometimes', 'array'],
            'permission_slugs.*' => ['string', 'max:128'],
        ];
    }
}
