import { getGlobalExt } from "@mas.io/pollen-utils";
import { joinUrl } from "./format";
import globalConfig from "./../../../config.json";

export const prefixPagePath = "/antbuilder/core/pages";

export const authLoginType = {
	1: "user", // 主动授权
	2: "base", // 基础信息
	3: "single", // 手机号
	4: "single", // 身份证
};

export const scopesType = {
	1: "auth_user",
	2: "userInfo",
	3: "phoneNumber",
	4: "IDNumber",
};

export const loginUrl = {
	auth_user: "api/v1/user/auth/login",
	userInfo: "api/v1/user/base/login",
	phoneNumber: "api/v1/user/single/login",
};

export const globalExt = globalConfig.ext.global || getGlobalExt() || {};

export const { authCodeKey } = globalExt;

export const { disableActiveAuthUser } = globalExt;

export const { url: host } = globalExt;
export const { openNewVersion } = globalExt;
export const { debugTemplateUuid } = globalExt;
export const { debugNoCache } = globalExt;
export const { ywtUrl: ywtHost } = globalExt;
export const { ywtPrefix: ywtEnvVersionPrefix } = globalExt;
export const { gwAppId } = globalExt;
export const { terminal } = globalExt;

export const universeUrl = host.replace("ab-saas-api", "universe");

export const ywtRequestUrl = ywtHost + ywtEnvVersionPrefix;

export const imgSrcPrefix = joinUrl(globalExt.url, "api/v1/getImage/");
export const getTicketUrl = "api/v1/getTicket";

export const getSettintsUrl = "api/v1/index/settings/query";

export const getRegionListUrl = "api/v1/index/region/list";

export const userInfoUrl = "api/v1/user/info";

export const openCardUrl = "api/v1/card/openCard";

export const openNewCardUrl = "api/v1/card/openNewCard";

export const getCardLevelUrl = "api/v1/mall/member/card/getLevel";

export const getOpenCardUrl = "api/v1/component/service/card/getCardConfig";

export const getMemberInfoUrl = "api/v1/card/getMemberInfo";

export const getSettingsUrl = "api/v1/index/settings/query";

export const getIndexQueryUrl = "api/v2/index/basic/query";

export const checkCertifyValidUrl = "api/v1/checkCertifyValid";

export const authAndApplyFaceUrl = "api/v1/authAndApplyFace";

export const authCertTypeUrl = "api/v1/cert/status/authCertType";

export const serviceReportUrl = "api/v1/data/report";

export const getComponentDetailUrl = "api/v1/component/list";

export const serviceReportCloudMonitorUrl = "api/v1/data/reportCM";

export const getServiceInfoUrl = "api/v2/component/service/info";

export const activeStatusUrl = "api/v1/plugin_api/medicareQuery/activeStatus"; // 未激活测试 ?bind=NOT_BIND

export const paymentUrl = "api/v1/plugin_api/medicareQuery/payment"; // todo remove city

export const expenseUrl = "api/v1/plugin_api/medicareQuery/expense"; // todo remove city

export const accountinfoUrl = "api/v1/plugin_api/medicareQuery/accountinfo"; // todo remove city

export const updateUserInfoUrl = "api/v1/user/update";

export const getTabBarDetailUrl = "api/v2/index/basic/tabbar";

export const getFormConfigDetailUrl = "api/v1/form/detail.json";

export const saveFormDataUrl = "api/v1/formData/save.json";

export const getServiceDynamicListUrl = "api/v1/component/service/dynamic/list";

// 页面缓存key
export const pageDataKey = "PAGE_DATA_KEY";

// 获取页面信息
export const getPageInfoUrl = "api/v2/index/basic/pageInfo";

export const defaultErrMsg = "抱歉，系统异常，请稍后再试";

// 获取用户状态接口
export const checkLoginUrl = "api/v1/user/login";

export const dynamicPageName = "one";

export const industryEntry = "/antbuilder/industry";

// C端订阅成功后，通知后端存储数据
export const messageSubscribeNotifyUrl =
	"api/v2/index/message/subscribe/notify";

export const mktApplyNotifyUrl = "/api/v1/marketing/receiveAlipayCoupon";

export const userInfoList = [
	{
		name: "头像",
		key: "avatar",
		value: "",
		hasImg: true,
		notNeedArrow: true,
		canShow: true, // 是否必须展示
	},
	{
		name: "昵称",
		key: "nickName",
		value: "",
		notNeedArrow: true,
		canShow: true, // 是否必须展示
	},
	{
		name: "手机号码",
		key: "phone",
		value: "",
		notNeedArrow: true,
	},
	{
		name: "姓名",
		key: "fullName",
		value: "",
		notNeedArrow: true,
		canShow: true, // 是否必须展示
	},
	// {
	//   name: '邮箱',
	//   key: 'email',
	//   placeholder: '请填写',
	//   value: '',
	//   canShow: true, // 是否必须展示
	// },
	{
		name: "身份证号",
		key: "idCardNo",
		value: "",
		notNeedArrow: true,
	},
];
