import request from '@/utils/request'

// Categories
export function getCategories(query) {
  return request({
    url: '/categories/',
    method: 'get',
    params: query
  })
}

export function createCategory(data) {
  return request({
    url: '/categories/',
    method: 'post',
    data
  })
}

export function updateCategory(id, data) {
  return request({
    url: `/categories/${id}/`,
    method: 'put',
    data
  })
}

export function deleteCategory(id) {
  return request({
    url: `/categories/${id}/`,
    method: 'delete'
  })
}

// Projects
export function getProjects(query) {
  return request({
    url: '/projects/',
    method: 'get',
    params: query
  })
}

export function createProject(data) {
  return request({
    url: '/projects/',
    method: 'post',
    data
  })
}

export function updateProject(id, data) {
  return request({
    url: `/projects/${id}/`,
    method: 'put',
    data
  })
}

export function deleteProject(id) {
  return request({
    url: `/projects/${id}/`,
    method: 'delete'
  })
}

// Coupons
export function getCoupons(query) {
  return request({
    url: '/coupons/',
    method: 'get',
    params: query
  })
}

export function createCoupon(data) {
  return request({
    url: '/coupons/',
    method: 'post',
    data
  })
}

export function updateCoupon(id, data) {
  return request({
    url: `/coupons/${id}/`,
    method: 'put',
    data
  })
}

export function deleteCoupon(id) {
  return request({
    url: `/coupons/${id}/`,
    method: 'delete'
  })
}

// Banners
export function getBanners(query) {
  return request({
    url: '/banners/',
    method: 'get',
    params: query
  })
}

export function createBanner(data) {
  return request({
    url: '/banners/',
    method: 'post',
    data
  })
}

export function updateBanner(id, data) {
  return request({
    url: `/banners/${id}/`,
    method: 'put',
    data
  })
}

export function deleteBanner(id) {
  return request({
    url: `/banners/${id}/`,
    method: 'delete'
  })
}

// Students
export function getStudents(query) {
  return request({
    url: '/students/',
    method: 'get',
    params: query
  })
}

export function createStudent(data) {
  return request({
    url: '/students/',
    method: 'post',
    data
  })
}

export function updateStudent(id, data) {
  return request({
    url: `/students/${id}/`,
    method: 'put',
    data
  })
}

export function deleteStudent(id) {
  return request({
    url: `/students/${id}/`,
    method: 'delete'
  })
}

// Activities
export function getActivities(query) {
  return request({
    url: '/activities/',
    method: 'get',
    params: query
  })
}

export function createActivity(data) {
  return request({
    url: '/activities/',
    method: 'post',
    data
  })
}

export function updateActivity(id, data) {
  return request({
    url: `/activities/${id}/`,
    method: 'put',
    data
  })
}

export function deleteActivity(id) {
  return request({
    url: `/activities/${id}/`,
    method: 'delete'
  })
}

// Showcases
export function getShowcases(query) {
  return request({
    url: '/showcases/',
    method: 'get',
    params: query
  })
}

export function createShowcase(data) {
  return request({
    url: '/showcases/',
    method: 'post',
    data
  })
}

export function updateShowcase(id, data) {
  return request({
    url: `/showcases/${id}/`,
    method: 'put',
    data
  })
}

export function deleteShowcase(id) {
  return request({
    url: `/showcases/${id}/`,
    method: 'delete'
  })
}

// Exams
export function getExams(query) {
  return request({
    url: '/exams/',
    method: 'get',
    params: query
  })
}

export function createExam(data) {
  return request({
    url: '/exams/',
    method: 'post',
    data
  })
}

export function updateExam(id, data) {
  return request({
    url: `/exams/${id}/`,
    method: 'put',
    data
  })
}

export function deleteExam(id) {
  return request({
    url: `/exams/${id}/`,
    method: 'delete'
  })
}

// Honors
export function getHonors(query) {
  return request({
    url: '/student-honors/',
    method: 'get',
    params: query
  })
}

export function createHonor(data) {
  return request({
    url: '/student-honors/',
    method: 'post',
    data
  })
}

export function updateHonor(id, data) {
  return request({
    url: `/student-honors/${id}/`,
    method: 'put',
    data
  })
}

export function deleteHonor(id) {
  return request({
    url: `/student-honors/${id}/`,
    method: 'delete'
  })
}

// Levels
export function getLevels(query) {
  return request({
    url: '/student-levels/',
    method: 'get',
    params: query
  })
}

export function createLevel(data) {
  return request({
    url: '/student-levels/',
    method: 'post',
    data
  })
}

export function updateLevel(id, data) {
  return request({
    url: `/student-levels/${id}/`,
    method: 'put',
    data
  })
}

export function deleteLevel(id) {
  return request({
    url: `/student-levels/${id}/`,
    method: 'delete'
  })
}

export function assignCouponToStudent(id, couponId) {
  return request({
    url: `/students/${id}/assign_coupon/`,
    method: 'post',
    data: { coupon_id: couponId }
  })
}

