<?php

namespace App\Filament\Resources\MemberPoints;

use App\Filament\Resources\MemberPoints\Pages\CreateMemberPoint;
use App\Filament\Resources\MemberPoints\Pages\EditMemberPoint;
use App\Filament\Resources\MemberPoints\Pages\ListMemberPoints;
use App\Filament\Resources\MemberPoints\Schemas\MemberPointForm;
use App\Filament\Resources\MemberPoints\Tables\MemberPointsTable;
use App\Models\MemberPoint;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;

class MemberPointResource extends Resource
{
    protected static ?string $model = MemberPoint::class;
    protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedStar;
    protected static string|\UnitEnum|null $navigationGroup = 'Organisasi';
    protected static ?string $navigationLabel = 'Poin Anggota';

    public static function canAccess(): bool
    {
        return auth()->user()->hasRole('super_admin');
    }

    public static function form(Schema $schema): Schema
    {
        return MemberPointForm::configure($schema);
    }

    public static function table(Table $table): Table
    {
        return MemberPointsTable::configure($table);
    }

    public static function getRelations(): array
    {
        return [
            //
        ];
    }

    public static function getPages(): array
    {
        return [
            'index' => ListMemberPoints::route('/'),
            'create' => CreateMemberPoint::route('/create'),
            'edit' => EditMemberPoint::route('/{record}/edit'),
        ];
    }
}
