import request from '@/config/axios'

// 用户平台权限有效期 VO
export interface UserWebExpireTimeVO {
  userId: number // 用户id
  courseExpireTime: Date // 课程权限过期时间
  blocklyExpireTime: Date // 编程课权限过期时间
  aiCourseExpireTime: Date // AI实验课权限过期时间
}

// 用户平台权限有效期 API
export const UserWebExpireTimeApi = {
  // 查询用户平台权限有效期分页
  getUserWebExpireTimePage: async (params: any) => {
    return await request.get({ url: `/system/user-web-expire-time/page`, params })
  },

  // 查询用户平台权限有效期详情
  getUserWebExpireTime: async (id: number) => {
    return await request.get({ url: `/system/user-web-expire-time/get?id=` + id })
  },

  // 新增用户平台权限有效期
  createUserWebExpireTime: async (data: UserWebExpireTimeVO) => {
    return await request.post({ url: `/system/user-web-expire-time/create`, data })
  },

  // 修改用户平台权限有效期
  updateUserWebExpireTime: async (data: UserWebExpireTimeVO) => {
    return await request.put({ url: `/system/user-web-expire-time/update`, data })
  },

  // 删除用户平台权限有效期
  deleteUserWebExpireTime: async (id: number) => {
    return await request.delete({ url: `/system/user-web-expire-time/delete?id=` + id })
  },

  // 导出用户平台权限有效期 Excel
  exportUserWebExpireTime: async (params) => {
    return await request.download({ url: `/system/user-web-expire-time/export-excel`, params })
  }
}