import ajax from "./ajax";

export const getSiteConfig = async () => ajax(`/auth/getSiteConfig`);

export const login = async (params) => ajax(`/auth/login`, params, "POST");

export const bindCard = async (params) =>
  ajax(`/auth/bindCard`, params, "POST");

export const checkLineId = async (lineid) =>
  ajax(`/auth/checkLineId`, { lineid }, "GET");

export const getUserInfo = async () => ajax(`/user/getUserInfo`);

export const setUserLevel = async (level) =>
  ajax(`/user/setUserLevel`, { level }, "POST");

export const setUserTpl = async (tpl) =>
  ajax(`/user/setUserTpl`, { tpl }, "POST");

export const toggleSendWithAD = async (type) =>
  ajax(`/user/toggleSendWithAD`, { type }, "POST");

export const searchConnection = async (type) =>
  ajax(`/user/searchConnection`, { type }, "POST");

export const setUserNfcTpl = async (tpl) =>
  ajax(`/user/setUserNfcTpl`, { tpl }, "POST");

export const register = async (userInfo) =>
  ajax(`/auth/register`, userInfo, "POST");

export const updateCard = async (userInfo) =>
  ajax(`/card/updateCard`, userInfo, "POST");

export const updateCusCard = async (params) =>
  ajax(`/card/updateCusCard`, params, "POST");

//取得名片資料
export const getCard = async (params) => ajax(`/card/getCard`, params, "GET");

export const getCusCard = async (params) =>
  ajax(`/card/getCusCard`, params, "GET");

export const getVipCard = async (params) =>
  ajax(`/card/getVipCard`, params, "GET");

export const getCard1 = async (userid) =>
  ajax(`/card/getCard1`, { userid }, "GET");

export const updateSendCount = async (userid) =>
  ajax(`/user/updateSendCount`, { userid }, "GET");

//授權使用者
export const setAuthUser = async (params) =>
  ajax(`/user/setAuthUser`, params , "POST");

export const getAuthUsers = async () =>
  ajax(`/user/getAuthUsers`);

export const delAuthUser = async (id) =>
  ajax(`/user/delAuthUser`,{id});

export const getAuthList = async () =>
  ajax(`/user/getAuthList`);

//廣告
export const getMovie = async () =>
  ajax(`/ads/getMovie`);

export const getMarquee = async () =>
  ajax(`/ads/getMarquee`);

//通訊錄
export const addUserFavi = async (params) =>
  ajax(`/UserFavi/addUserFavi`, params , "POST");

