import request from '@/utils/request'

// Teachers
export function getTeachers(query) {
  return request({
    url: '/teachers/',
    method: 'get',
    params: query
  })
}

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

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

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

// Teaching Centers
export function getTeachingCenters(query) {
  return request({
    url: '/teaching-centers/',
    method: 'get',
    params: query
  })
}

export function createTeachingCenter(data) {
  return request({
    url: '/teaching-centers/',
    method: 'post',
    data
  })
}

export function updateTeachingCenter(id, data) {
  return request({
    url: `/teaching-centers/${id}/`,
    method: 'put',
    data
  })
}

export function deleteTeachingCenter(id) {
  return request({
    url: `/teaching-centers/${id}/`,
    method: 'delete'
  })
}

// 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'
  })
}

export function clearStudents() {
  return request({
    url: '/students/clear/',
    method: 'delete'
  })
}

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

// Student Coupons (Issued Coupons)
export function getStudentCoupons(query) {
  return request({
    url: '/student-coupons/',
    method: 'get',
    params: query
  })
}

export function updateStudentCoupon(id, data) {
  return request({
    url: `/student-coupons/${id}/`,
    method: 'patch',
    data
  })
}

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

// Student Projects (Enrollments)
export function getStudentProjects(query) {
  return request({
    url: '/student-projects/',
    method: 'get',
    params: query
  })
}

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

export function updateStudentProject(id, data) {
  return request({
    url: `/student-projects/${id}/`,
    method: 'patch',
    data
  })
}

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

// Student 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'
  })
}

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

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

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

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

// Notifications
export function getNotifications(query) {
  return request({
    url: '/notifications/',
    method: 'get',
    params: query
  })
}

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

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

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

// Notification Batches
export function getNotificationBatches(query) {
  return request({
    url: '/notification-batches/',
    method: 'get',
    params: query
  })
}

export function createNotificationBatch(data) {
  return request({
    url: '/notification-batches/',
    method: 'post',
    data
  })
}

export function getBatchRecipients(id) {
  return request({
    url: `/notification-batches/${id}/recipients/`,
    method: 'get'
  })
}

export function deleteNotificationBatch(id) {
  return request({
    url: `/notification-batches/${id}/`,
    method: 'delete'
  })
}

