import 'package:electronic_assistant/utils/mmkv_util.dart';
import 'package:flutter_umeng/flutter_umeng.dart';

import '../../utils/common_utils.dart';

class Constants {
  Constants._();

  static const String env = envTest;

  static const String envDev = 'dev';

  static const String envTest = 'test';

  static const String envProd = 'prod';

  static const String _devBaseUrl = "http://192.168.10.230:8880";

  static const String _testBaseUrl = "http://42.193.245.11";

  static const String _prodBaseUrl = "https://project-api.atmob.com";

  static String baseUrl = getBaseUrl();

  static const String privacyPolicy =
      "https://doc.v8dashen.com/doc/f5071be105382cb9";

  static const String privacyPolicyIos =
      "https://cdn.v8dashen.com/static/xt-xm-i-privacy.html";

  static const String userAgreement =
      "https://cdn.v8dashen.com/static/xt-xm-clause.html";

  static final String privacyPolicyKey = stringToUnicode('_privacyPolicyKey');

  static const String appDefaultChannel = "Android";
  static const int appDefaultAppId = 0;
  static const int appDefaultTgPlatformId = 0;

  static bool isProdEnv() {
    return Constants.env == Constants.envProd;
  }

  static const String recordServerVersion = 'recordServerVersion';

  //渠道
  static const String appChanelName = "app_channel_name";
  static const String appChannelId = "app_channel_id";
  static const String appTgPlatformId = "app_tg_platform_id";
}

String getBaseUrl() {
  switch (Constants.env) {
    case Constants.envDev:
      return Constants._devBaseUrl;
    case Constants.envTest:
      return Constants._testBaseUrl;
    case Constants.envProd:
      return Constants._prodBaseUrl;
    default:
      return Constants._devBaseUrl;
  }
}

bool isAgreePrivacyPolicy() {
  return KVUtil.getBool(Constants.privacyPolicyKey, false);
}

void setPrivacyPolicy(bool isAgree) {
  FlutterUmeng.setPolicyGrantResult(isAgree);
  KVUtil.putBool(Constants.privacyPolicyKey, isAgree);
}

class PayPlatform {
  static const int android = 1;
  static const int apple = 2;
}

class PayMethod {
  static const int alipay = 1;
  static const int wechat = 2;
  static const int apple = 3;
  static const int google = 4;
  static const int douYin = 5;
}

class Currency {
  static const String cny = "CNY";
  static const String usd = "USD";
}

class GuideConstants {
  GuideConstants._();

  static const String talkAddTemplateGuide = "talkAddTemplateGuide";

  static const String mainGuide = "mainGuide";
}