<?php

namespace App\Filament\Admin\Resources\Coupons\Schemas;

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

class CouponInfolist
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Section::make('General Information')
                    ->schema([
                        Grid::make(3)
                            ->schema([
                                TextEntry::make('code'),

                                TextEntry::make('type'),

                                TextEntry::make('value')
                                    ->numeric(),

                                IconEntry::make('is_active')
                                    ->boolean(),

                                TextEntry::make('valid_from')
                                    ->dateTime(),

                                TextEntry::make('valid_to')
                                    ->dateTime(),
                            ]),
                    ]),

                Section::make('Descriptions')
                    ->schema([
                        Grid::make(1)
                            ->schema([
                                TextEntry::make('en_description')
                                ->html()
                                    ->placeholder('-'),

                                TextEntry::make('fa_description')
                                ->html()

                                    ->placeholder('-'),
                            ]),
                    ])
                    ->columnSpanFull(),

                Section::make('Meta')
                    ->schema([
                        Grid::make(2)
                            ->schema([
                                TextEntry::make('user.name')
                                    ->label('User'),

                                TextEntry::make('created_at')
                                    ->dateTime()
                                    ->placeholder('-'),

                                TextEntry::make('updated_at')
                                    ->dateTime()
                                    ->placeholder('-'),
                            ]),
                    ])
            ]);
    }
}
