<?php

namespace App\Services;

class PaymentGatewayConfigService
{
    public function applyRuntimeOverrides(): void
    {
        // Stripe, PayPal et simulate sont forces depuis la configuration .env.
    }

    public function forBo(): array
    {
        $simulateFromConfig = (bool) config('lineup.payments.simulate', true);
        $stripeSecretFromConfig = (string) config('lineup.payments.stripe.secret_key', '');
        $stripeWebhookFromConfig = (string) config('lineup.payments.stripe.webhook_secret', '');
        $paypalModeFromConfig = (string) config('lineup.payments.paypal.mode', 'sandbox');
        $paypalClientIdFromConfig = (string) config('lineup.payments.paypal.client_id', '');
        $paypalSecretFromConfig = (string) config('lineup.payments.paypal.client_secret', '');
        $paypalWebhookFromConfig = (string) config('lineup.payments.paypal.webhook_id', '');

        return [
            'simulate' => $simulateFromConfig,
            'env_forced' => true,
            'stripe' => [
                'secret_key' => $stripeSecretFromConfig,
                'webhook_secret' => $stripeWebhookFromConfig,
            ],
            'paypal' => [
                'mode' => $paypalModeFromConfig,
                'client_id' => $paypalClientIdFromConfig,
                'client_secret' => $paypalSecretFromConfig,
                'webhook_id' => $paypalWebhookFromConfig,
            ],
        ];
    }

    public function saveFromBo(array $data, int $adminId): void
    {
        // Lecture seule depuis .env: aucune persistance BO.
    }
}
