import { requestClient } from '#/api/request';

const prefix = 'store-bank-card-report/';

export async function getStoreBankCardReportDetail(storeId: number) {
  return requestClient.get<any>(`${prefix}detail`, {
    params: { store_id: storeId },
  });
}

export async function getSelectableBankCards(storeId: number) {
  return requestClient.get<{ options: Array<{ value: string; label: string; payload: Record<string, any> }> }>(
    `${prefix}selectable-cards`,
    {
      params: { store_id: storeId },
    },
  );
}

export async function reportStoreBankCard(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}report`, data);
}

export async function updateStoreBankCard(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}update`, data);
}

export async function queryStoreBankCardStatus(data: { id: number }) {
  return requestClient.post<any>(`${prefix}query-status`, data);
}

export async function syncStoreBankCardStatusByStore(storeId: number) {
  return requestClient.post<any>(`${prefix}sync-status-by-store`, {
    store_id: storeId,
  });
}

export async function migrateStoreBankCardToYiiStore(data: {
  store_id: number;
  report_id?: number;
}) {
  return requestClient.post<any>(`${prefix}migrate-bank-to-store`, data);
}
