<?php

namespace App\Filament\Admin\Resources\Coupons;

use App\Filament\Admin\Resources\Coupons\Pages\CreateCoupon;
use App\Filament\Admin\Resources\Coupons\Pages\EditCoupon;
use App\Filament\Admin\Resources\Coupons\Pages\ListCoupons;
use App\Filament\Admin\Resources\Coupons\Pages\ViewCoupon;
use App\Filament\Admin\Resources\Coupons\RelationManagers\OrderPackagesRelationManager;
use App\Filament\Admin\Resources\Coupons\Schemas\CouponForm;
use App\Filament\Admin\Resources\Coupons\Schemas\CouponInfolist;
use App\Filament\Admin\Resources\Coupons\Tables\CouponsTable;
use App\Filament\Admin\Resources\Coupons\RelationManagers\OrderProductsRelationManager;
use App\Models\Coupon;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use UnitEnum;

class CouponResource extends Resource
{
    protected static ?string $model = Coupon::class;

    protected static string|BackedEnum|null $navigationIcon = Heroicon::BoltSlash;
    protected static string|UnitEnum|null $navigationGroup = "Coupon & Credit Coupon";
    protected static ?int $navigationSort = 1;
    protected static ?string $recordTitleAttribute = 'Coupon';

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

    public static function infolist(Schema $schema): Schema
    {
        return CouponInfolist::configure($schema);
    }

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

    public static function getRelations(): array
    {
        return [
            OrderProductsRelationManager::class,
            OrderPackagesRelationManager::class,
        ];
    }

    public static function getPages(): array
    {
        return [
            'index' => ListCoupons::route('/'),
            'create' => CreateCoupon::route('/create'),
            'view' => ViewCoupon::route('/{record}'),
            'edit' => EditCoupon::route('/{record}/edit'),
        ];
    }
}
