<?php
namespace App\Config;

class WhatsAppConfig {
    public static function getDriver(): string {
        return Config::get('WHATSAPP_DRIVER', 'gateway'); // 'gateway' (QR code) or 'meta' (Cloud API)
    }

    public static function getGatewayInstanceId(): string {
        return Config::get('WHATSAPP_GATEWAY_INSTANCE_ID', '');
    }

    public static function getGatewayToken(): string {
        return Config::get('WHATSAPP_GATEWAY_TOKEN', '');
    }

    public static function getGatewayApiUrl(): string {
        return Config::get('WHATSAPP_GATEWAY_API_URL', 'https://api.ultramsg.com');
    }

    public static function getPhoneNumberId(): string {
        return Config::get('WHATSAPP_PHONE_NUMBER_ID', '');
    }

    public static function getWabaId(): string {
        return Config::get('WHATSAPP_WABA_ID', '');
    }

    public static function getAccessToken(): string {
        return Config::get('WHATSAPP_ACCESS_TOKEN', '');
    }

    public static function getVerifyToken(): string {
        return Config::get('WHATSAPP_VERIFY_TOKEN', 'whatsapp_crm_secure_token_2026');
    }

    public static function getAppSecret(): string {
        return Config::get('WHATSAPP_APP_SECRET', '');
    }

    public static function getApiVersion(): string {
        return Config::get('WHATSAPP_API_VERSION', 'v19.0');
    }

    public static function isSimulatorMode(): bool {
        $val = Config::get('WHATSAPP_SIMULATOR_MODE', 'false');
        return filter_var($val, FILTER_VALIDATE_BOOLEAN);
    }

    public static function getApiBaseUrl(): string {
        $version = self::getApiVersion();
        $phoneId = self::getPhoneNumberId();
        return "https://graph.facebook.com/{$version}/{$phoneId}";
    }
}
