<?php

namespace App\Filament\Resources\Plans\Tables;

use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Actions\ViewAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class PlansTable
{
    public static function configure(Table $table): Table
    {
        return $table
            ->columns([
                TextColumn::make('name')
                    ->searchable(),
                TextColumn::make('price')
                    ->label('Monthly')
                    ->money()
                    ->sortable(),
                TextColumn::make('monthly_discount_percent')
                    ->label('Monthly off')
                    ->suffix('%')
                    ->numeric()
                    ->sortable(),
                TextColumn::make('yearly_price')
                    ->label('Yearly')
                    ->money()
                    ->placeholder('12x monthly')
                    ->sortable(),
                TextColumn::make('yearly_discount_percent')
                    ->label('Yearly off')
                    ->suffix('%')
                    ->numeric()
                    ->sortable(),
                TextColumn::make('link_limit')
                    ->numeric()
                    ->sortable(),
                TextColumn::make('custom_domain_limit')
                    ->label('Custom domains')
                    ->numeric()
                    ->sortable(),
                IconColumn::make('ad_feature_enabled')
                    ->boolean(),
                TextColumn::make('analytics_retention_days')
                    ->numeric()
                    ->sortable(),
                IconColumn::make('api_access')
                    ->boolean(),
                IconColumn::make('is_featured')
                    ->label('Featured')
                    ->boolean()
                    ->sortable(),
                TextColumn::make('card_badge_label')
                    ->label('Ribbon')
                    ->placeholder('-')
                    ->searchable()
                    ->toggleable(isToggledHiddenByDefault: true),
                TextColumn::make('sort_order')
                    ->sortable()
                    ->toggleable(isToggledHiddenByDefault: true),
                TextColumn::make('status')
                    ->searchable(),
                TextColumn::make('created_at')
                    ->dateTime()
                    ->sortable()
                    ->toggleable(isToggledHiddenByDefault: true),
                TextColumn::make('updated_at')
                    ->dateTime()
                    ->sortable()
                    ->toggleable(isToggledHiddenByDefault: true),
            ])
            ->filters([
                //
            ])
            ->recordActions([
                ViewAction::make(),
                EditAction::make(),
            ])
            ->toolbarActions([
                BulkActionGroup::make([
                    DeleteBulkAction::make(),
                ]),
            ]);
    }
}
