import request from './request' export interface PageResponse { content: T[] totalElements: number totalPages: number currentPage: number pageSize: number } export interface ReimApplicationSummary { id: number | string applicationNo: string title: string applicantName: string departmentName: string expenseTypeName: string category: string totalAmount: number applicationStatus: string approvalStatus: string currentApprovalNode: string receiptStatus: string paymentStatus: string budgetStatus: string submitTime: string createdAt: string returnReason?: string paidAmount?: number remainingAmount?: number } export interface ReimApplicationDetail { id: number | string applicationNo: string title: string applicantName: string applicantEmployeeNo: string departmentName: string expenseTypeId: number expenseTypeName: string category: string totalAmount: number description: string applicationStatus: string approvalStatus: string currentApprovalNode: string receiptStatus: string paymentStatus: string budgetStatus: string sourceDocNo: string sourceStatus: string payeeName: string payeeBankId: number bankName: string bankAccountMask: string returnReason: string submitTime: string createdAt: string updatedAt: string expenseItems: ExpenseItem[] invoices: Invoice[] attachments: Attachment[] approvalRecords: ApprovalRecord[] payments: PaymentRecord[] paidAmountSnapshot?: number remainingAmountSnapshot?: number } export interface ExpenseItem { id?: number | string seqNo?: number expenseDate: string category: string description?: string amount: number } export interface CreateApplicationRequest { title: string expenseTypeId: number category: string totalAmount: number description: string payeeName: string payeeBankId: number items: ExpenseItem[] } export interface Invoice { id: number | string invoiceNo: string invoiceType: string issueDate: string amount: number sellerName: string verifyStatus: string } export interface Attachment { id: number | string fileName: string fileType: string fileUrl: string } export interface ApprovalRecord { id: number | string nodeName: string approverName: string action: string comment: string actionTime: string } export interface PaymentRecord { id: number | string paymentNo: string applicationId?: number | string paymentAmount: number totalAmount: number paidAmount: number remainingAmount: number paymentMethod: string referenceNo?: string paymentStatus: string operatorName: string paymentTime: string remark: string } export const reimbursementApi = { getWorkbench: (): Promise => request.get('/v1/reimbursements/workbench'), getMyApplications: (params?: { status?: string; page?: number; size?: number }): Promise> => request.get('/v1/reimbursements/my', { params }), getDetail: (id: number | string): Promise => request.get(`/v1/reimbursements/${id}`), getByApplicationNo: (no: string): Promise => request.get(`/v1/reimbursements/no/${no}`), create: (data: CreateApplicationRequest): Promise => request.post('/v1/reimbursements', data), update: (id: number | string, data: CreateApplicationRequest): Promise => request.put(`/v1/reimbursements/${id}`, data), submit: (id: number | string): Promise => request.post(`/v1/reimbursements/${id}/submit`), receive: (id: number | string): Promise => request.post(`/v1/reimbursements/${id}/receive`), delete: (id: number | string): Promise => request.delete(`/v1/reimbursements/${id}`), } export const accountsPayableApi = { getTasks: (params?: { status?: string; page?: number; size?: number }): Promise => request.get('/v1/accounts-payable/tasks', { params }), getTaskDetail: (id: number | string): Promise => request.get(`/v1/accounts-payable/tasks/${id}`), approve: (applicationId: number | string, comment: string): Promise => request.post('/v1/accounts-payable/approve', { applicationId, comment }), reject: (applicationId: number | string, comment: string, returnReason: string): Promise => request.post('/v1/accounts-payable/reject', { applicationId, comment, returnReason }), getHistory: (): Promise => request.get('/v1/accounts-payable/history'), } export const cashierApi = { getTasks: (params?: { status?: string; page?: number; size?: number }): Promise => request.get('/v1/cashier/tasks', { params }), getTaskDetail: (id: number | string): Promise => request.get(`/v1/cashier/tasks/${id}`), executePayment: (applicationId: number | string, paymentAmount: number, remark?: string, idempotencyKey?: string): Promise => request.post('/v1/cashier/pay', { applicationId, paymentAmount, remark }, idempotencyKey ? { headers: { 'Idempotency-Key': idempotencyKey } } : undefined), partialPayment: (applicationId: number | string, paymentAmount: number, remark?: string, idempotencyKey?: string): Promise => request.post('/v1/cashier/partial-pay', { applicationId, paymentAmount, remark }, idempotencyKey ? { headers: { 'Idempotency-Key': idempotencyKey } } : undefined), getHistory: (): Promise => request.get('/v1/cashier/history'), } export const dashboardApi = { getStats: (): Promise => request.get('/v1/dashboard/stats'), getRecent: (limit?: number): Promise => request.get('/v1/dashboard/recent', { params: { limit } }), }