import 'app_environment.dart';

class FlavorValues {
  FlavorValues({
    required this.server,
    required this.baseUrl,
    required this.appName,
    required this.LocalDBName,
  });
  final String server;
  final String baseUrl;
  final String appName;
  final String LocalDBName;
}

abstract class FlavorConfig {
  static AppEnvironment? _flavor;
  static FlavorValues? _values;
  static void set(AppEnvironment flavor, FlavorValues values) {
    _flavor = flavor;
    _values = values;
  }

  static bool isInitialized() => _flavor != null;

  static bool isDev() => _flavor! == AppEnvironment.DEV;

  static bool isProduction() => _flavor! == AppEnvironment.PROD;

  static FlavorValues get values => _values!;
}

void setFlavorDevelopment() {
  FlavorConfig.set(
    AppEnvironment.DEV,
    FlavorValues(
      appName: 'LaFarm',
      server: 'https://tpf.aztrace.vn',
      baseUrl: 'https://tpf.aztrace.vn',
      LocalDBName: 'AppLocalStorage',
    ),
  );
}

void setFlavorOutsourceDevelopment() {
  FlavorConfig.set(
    AppEnvironment.DEV,
    FlavorValues(
      appName: 'LaFarm',
      server: 'https://tpf.aztrace.vn/',
      baseUrl: 'https://tpf.aztrace.vn/',
      LocalDBName: 'AppLocalStorage',
    ),
  );
}

void setFlavorProduction() {
  FlavorConfig.set(
    AppEnvironment.PROD,
    FlavorValues(
      appName: 'Trang Trai Bo',
      server: 'https://test-trangtraibo.aristqnu.com/',
      baseUrl: 'https://test-trangtraibo.aristqnu.com/',
      LocalDBName: 'AppLocalStorage',
    ),
  );
}
