import { apiFetch, type PaginatedResponse } from './api'; export interface DATEVExportResponse { id: string; start_date: string; end_date: string; file_path?: string | null; total_amount: number; created_at?: string; } export interface DATEVExportCreate { start_date: string; end_date: string; } export async function createDatevExport(data: DATEVExportCreate): Promise { return apiFetch('/datev/export', { method: 'POST', body: JSON.stringify(data), }); } export async function listDatevExports(page = 1, pageSize = 20): Promise> { return apiFetch>(`/datev/exports?page=${page}&page_size=${pageSize}`); } export function getDatevDownloadUrl(id: string): string { const baseUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000/api/v1'; return `${baseUrl}/datev/exports/${id}/download`; }