<?php

namespace App\Filament\Resources\DelayedGoods;

use App\Filament\Resources\DelayedGoods\Pages\ListDelayedGoods;
use App\Filament\Resources\DelayedGoods\Schemas\DelayedGoodForm;
use App\Filament\Resources\DelayedGoods\Tables\DelayedGoodsTable;
use App\Models\DelayedGood;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use UnitEnum;

class DelayedGoodResource extends Resource
{
    protected static ?string $model = DelayedGood::class;

    protected static string|UnitEnum|null $navigationGroup = 'Kelola';

    protected static string|BackedEnum|null $navigationIcon = Heroicon::Clock;

    protected static ?string $navigationLabel = 'Barang Tertunda';

    protected static ?int $navigationSort = 4;

    protected static ?string $recordTitleAttribute = 'stored_date';

    protected static ?string $slug = 'manage/delayed-goods';

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

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

    public static function getPages(): array
    {
        return [
            'index' => ListDelayedGoods::route('/'),
        ];
    }

    public static function getRecordRouteBindingEloquentQuery(): Builder
    {
        return parent::getRecordRouteBindingEloquentQuery()
            ->withoutGlobalScopes([
                SoftDeletingScope::class,
            ]);
    }
}
