import api from './api'
import type { Activity, ActivityType } from '@/types/activity'

export async function getProjectActivities(
  projectId: number,
  skip = 0,
  limit = 50,
  typeFilter?: ActivityType,
  days?: number
): Promise<Activity[]> {
  const params: any = { skip, limit }
  if (typeFilter) params.type_filter = typeFilter
  if (days) params.days = days
  
  const response = await api.get(`/activities/project/${projectId}`, { params })
  return response.data
}

export async function getTaskActivities(
  taskId: number,
  skip = 0,
  limit = 50
): Promise<Activity[]> {
  const response = await api.get(`/activities/task/${taskId}`, {
    params: { skip, limit }
  })
  return response.data
}

export async function getUserActivities(
  userId: number,
  skip = 0,
  limit = 50,
  days?: number
): Promise<Activity[]> {
  const params: any = { skip, limit }
  if (days) params.days = days
  
  const response = await api.get(`/activities/user/${userId}`, { params })
  return response.data
}

export async function getRecentActivities(
  skip = 0,
  limit = 20
): Promise<Activity[]> {
  const response = await api.get('/activities/recent', {
    params: { skip, limit }
  })
  return response.data
}
