<?php

namespace App\Filament\Resources\Roles\Schemas;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
use Filament\Schemas\Schema;

class RoleForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                TextInput::make('name')
                    ->label('Nazwa')
                    ->required()
                    ->unique(ignoreRecord: true),
                Select::make('permissions')
                    ->label('Uprawnienia')
                    ->multiple()
                    ->relationship('permissions', 'name')
                    ->preload()
                    ->searchable(),
            ]);
    }
}
