import 'package:flutter/foundation.dart';

class ApiConfig {
  /// Metti true quando vuoi puntare al server live
  static const bool useLive = true;

  /// Dominio produzione
  static const String liveHost = 'app.yogiboook.com';

  // Host handling DEV:
  // - Web: localhost
  // - Android emulator: 10.0.2.2 (maps to host machine)
  static String get _devHost {
    if (kIsWeb) return 'localhost';
    if (defaultTargetPlatform == TargetPlatform.android) return '10.0.2.2';
    return 'localhost';
  }

  static String get host => useLive ? liveHost : _devHost;

  static String get scheme => useLive ? 'https' : 'http';

  /// Laravel/Vanguard API (login, password remind, ecc)
  /// DEV:  http://10.0.2.2/yogiboook/public/api
  /// LIVE: https://app.yogiboook.com/public/api
  static String get laravelApiBase {
    if (useLive) return '$scheme://$host/public/api';
    return '$scheme://$host/yogiboook/public/api';
  }

  /// PHP custom APIs
  /// DEV:  http://10.0.2.2/yogiboook/public/userarea/api
  /// LIVE: https://app.yogiboook.com/public/userarea/api
  static String get phpApiBase {
    if (useLive) return '$scheme://$host/public/userarea/api';
    return '$scheme://$host/yogiboook/public/userarea/api';
  }

  static const String deviceName = 'FlutterApp';
}
