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

const prefix = 'invoice-center/';

/** 开票申请列表 */
export async function getInvoiceCenterListApi(data: any) {
  return requestClient.get<any>(`${prefix}list`, { params: data });
}

/** 开票详情 */
export async function getInvoiceCenterDetailApi(data: any) {
  return requestClient.get<any>(`${prefix}detail`, { params: data });
}

/** 受理本方开票 */
export async function acceptInvoiceApi(data: { id: number; party_id?: number }) {
  return requestClient.post<any>(`${prefix}accept`, data);
}

/** 拒绝 */
export async function rejectInvoiceApi(data: { id: number; reject_reason: string }) {
  return requestClient.post<any>(`${prefix}reject`, data);
}

/** 完成本方开票（按登录角色锁定分账方） */
export async function completeInvoiceApi(data: {
  party_id?: number;
  invoice_code: string;
  invoice_files: string[];
  id?: number;
}) {
  return requestClient.post<any>(`${prefix}complete`, data);
}

/** 重发邮件 */
export async function resendInvoiceEmailApi(data: { id: number }) {
  return requestClient.post<any>(`${prefix}resend-email`, data);
}

/** 各状态数量（Tab 徽标） */
export async function getInvoiceStatusStatsApi() {
  return requestClient.get<Record<string, number>>(`${prefix}status-stats`);
}
