import { baseClient } from './base.js';

export const analyticsApi = {
  getWorkspaceAnalytics(workspaceId, period = '7d', startDate = null, endDate = null) {
    const params = new URLSearchParams();
    if (startDate && endDate) {
      params.set('startDate', startDate);
      params.set('endDate', endDate);
    } else {
      params.set('period', period);
    }
    return baseClient.get(`/workspaces/${workspaceId}/analytics?${params.toString()}`);
  },
};
