<?php

namespace App\Filament\Resources\EarnApplications\Schemas;

use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;

class EarnApplicationForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Select::make('user_id')
                    ->relationship('user', 'email')
                    ->searchable()
                    ->required(),
                Select::make('collateral_asset_id')
                    ->relationship('collateralAsset', 'symbol')
                    ->searchable()
                    ->required(),
                TextInput::make('stake_amount_coin')
                    ->required()
                    ->numeric(),
                TextInput::make('duration_days')
                    ->required()
                    ->numeric(),
                TextInput::make('apr_at_submission')
                    ->required()
                    ->numeric()
                    ->default(0),
                TextInput::make('estimated_returns_usd')
                    ->numeric(),
                Select::make('status')
                    ->required()
                    ->default('awaiting_payment_proof'),
                TextInput::make('payout_wallet_address'),
                TextInput::make('wallet_provider_name'),
                TextInput::make('network'),
                FileUpload::make('payment_proof_path')
                    ->disk('public')
                    ->directory('uploads/payment-proofs')
                    ->downloadable()
                    ->openable()
                    ->previewable(),
                DateTimePicker::make('submitted_at'),
                DateTimePicker::make('payment_proof_submitted_at'),
            ]);
    }
}
