<?php

namespace App\Filament\Resources\Permissions\Schemas;

use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;

class PermissionForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                TextInput::make('name')
                    ->label('نام')
                    ->required()
                    ->maxLength(255),
                TextInput::make('slug')
                    ->label('شناسه')
                    ->required()
                    ->unique(ignoreRecord: true)
                    ->maxLength(255),
                CheckboxList::make('roles')
                    ->label('نقش‌ها')
                    ->relationship(titleAttribute: 'name')
                    ->searchable()
                    ->bulkToggleable()
                    ->columns(2),
            ]);
    }
}
