<?php

namespace Modules\Identity\Filament\Resources\Customers\Schemas;

use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;

class CustomerInfolist
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Section::make('Customer')
                    ->schema([
                        Grid::make(3)
                            ->schema([
                                TextEntry::make('name'),
                                TextEntry::make('email'),
                                TextEntry::make('created_at')->label('Joined')->dateTime(),
                                TextEntry::make('bookings_count')->label('Total Bookings')->state(
                                    fn ($record) => $record->bookings()->count(),
                                ),
                            ]),
                    ]),
            ]);
    }
}
