import Taro from "@tarojs/taro"

const APP_NAME = process.env.TARO_APP_NAME ?? 'miniGreenLeaf'
let appVersion = '1.0.26'
let envVersion:"develop" | "trial" | "release" = 'develop'

// 小程序 api 地址
// let baseUrlDev = 'http://192.168.1.113:3000/'
let baseUrlDev = 'https://dev-api.xiaolvye.cn/'
let baseUrlProd = 'https://api.xiaolvye.cn/'
let baseUrl = baseUrlDev;

//  html5 地址
let homeUrlDev = 'https://dev-m.xiaolvye.cn/'
let homeUrlProd = 'https://xiaolvye.cn/'
let homeUrl = homeUrlDev

if(process.env.TARO_ENV == "weapp"){
	// 根据版本号判断是否为线上版本 ？？
	const accountInfo = Taro.getAccountInfoSync();
	const version = accountInfo.miniProgram.version;
	envVersion = accountInfo.miniProgram.envVersion;

	console.log('app version:', version, envVersion)
	if(version.length){
		baseUrl = baseUrlProd
		appVersion = version
		homeUrl = homeUrlProd
		console.log('online version:', version)
	}	
}

const BASE_URL = baseUrl
const APP_VERSION =  appVersion
const APP_ENV_VERSION =  envVersion
const HOME_URL = homeUrl

const APP_NAME_TEXT = process.env.TARO_APP_NAME_TEXT ?? ''
const APP_STORY_URL = process.env.TARO_APP_STORY_URL ?? ''
const APP_AGREEMENT_URL = process.env.TARO_APP_AGREEMENT_URL ?? ''
const TARO_APP_ID = process.env.TARO_APP_ID ?? ''

// 是否是小绿页
const IS_MINI_GREEN_LEAF = APP_NAME === 'miniGreenLeaf'
// 是否允许跳转至vip页面
const ENABLE_UPGRADE_VIP = IS_MINI_GREEN_LEAF


const DEFAULT_AVATAR = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAdiSURBVHgB7ZxPbBR1FMe/b7atQkGnJHKSuFwtifWgCVxoE0AIJJZo8Nhi8GZCjXql3asBgYMXNLYcIRIwkUApsu1FIh6oCeXaNXgRDh1Ltw10d56/99s/7r/ZnZ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aYIoOrQ2P02SOLKnn1Nt6H1gletc+pN5fVo/eYm99IfUgYXfFtTVIjVwBpu1qUqCe3+QXqWy7rDay+UijXaal5eDGo1pYR7gyUVm6yuV4fWRqhwhSlg7B5m9p3FYaKOoWhu0cU38DxzOUxhCpi/yZuyKsRi/eGJJZaCWZOilGJcoErseyv74Wb6kI3FyUKfsgCbZKdtrdsECi5m1eIuhVg2BZdmkF5NmRallP8AaWZYajAlJP8AAAAASUVORK5CYII='
const DEFAULT_AGENT = {
    avatar: DEFAULT_AVATAR,
    name: "小蓝本助手",
  };

export {
	APP_VERSION,
	APP_NAME,
	APP_NAME_TEXT,
	APP_STORY_URL,
	APP_AGREEMENT_URL,
	BASE_URL,
	APP_ENV_VERSION,
	HOME_URL,
	TARO_APP_ID,
	ENABLE_UPGRADE_VIP,
	IS_MINI_GREEN_LEAF,
	DEFAULT_AVATAR,
	DEFAULT_AGENT,
}




export enum VIP_LEVEL {
	FREE = 'vip_free',
	PLUS = 'vip_plus',
	SUPER = 'vip_super',
} 

// 合作方域名链接，用于 webview
export const CORP_DOMAINS = [
	's.mcdl0.cn',
]
