import { request } from '@umijs/max';

export const _getOrderTransactionList = async (): Promise<API.DefaultObjectResponse> => {
  return request('/api/v1/admin/order/all', {
    method: 'get',
  });
};

export const _getLeaveTime = async (orderId: string): Promise<API.DefaultObjectResponse> => {
  return request(`/api/v1/admin/order/order/leave-time`, {
    method: 'get',
    params: {
      orderId,
    },
  });
};
export const _unlock = async (orderId: string): Promise<API.DefaultObjectResponse> => {
  return request(`/api/v1/admin/order/unlock`, {
    method: 'put',
    data: {
      orderId,
    },
  });
};
export const _updateRemark = async (options: {
  orderId: string;
  remark: string;
}): Promise<API.DefaultObjectResponse> => {
  const { orderId, remark } = options;
  return request('/api/v1/admin/order/remark', {
    method: 'put',
    data: {
      orderId,
      remark,
    },
  });
};

export const _getTopUpTransactionList = async (): Promise<API.DefaultObjectResponse> => {
  return request('/api/v1/admin/customer/top-up/all', {
    method: 'get',
  });
};

export const _getWalletTransactionList = async (): Promise<API.DefaultObjectResponse> => {
  return request('/api/v1/admin/order/wallet/all', {
    method: 'get',
  });
};

export const _syncData = async (): Promise<API.DefaultObjectResponse> => {
  return request('/api/v1/admin/setting/sync', {
    method: 'put',
  });
};
