import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 用户主题信息 */
export interface UserThemes {
          id: number; // 主键 id
          themeId: number; // 主题主键
          userId: number; // 用户 Id
          createdAt: string | Dayjs; // 创建时间
          viewDeleted: boolean; // 是否从显示移除
          updatedAt: boolean; // 更新时间
  }

// 用户主题 API
export const UserThemesApi = {
  // 查询用户主题分页
  getUserThemesPage: async (params: any) => {
    return await request.get({ url: `/keyboard/user-themes/page`, params })
  },

  // 查询用户主题详情
  getUserThemes: async (id: number) => {
    return await request.get({ url: `/keyboard/user-themes/get?id=` + id })
  },

  // 新增用户主题
  createUserThemes: async (data: UserThemes) => {
    return await request.post({ url: `/keyboard/user-themes/create`, data })
  },

  // 修改用户主题
  updateUserThemes: async (data: UserThemes) => {
    return await request.put({ url: `/keyboard/user-themes/update`, data })
  },

  // 删除用户主题
  deleteUserThemes: async (id: number) => {
    return await request.delete({ url: `/keyboard/user-themes/delete?id=` + id })
  },

  /** 批量删除用户主题 */
  deleteUserThemesList: async (ids: number[]) => {
    return await request.delete({ url: `/keyboard/user-themes/delete-list?ids=${ids.join(',')}` })
  },

  // 导出用户主题 Excel
  exportUserThemes: async (params) => {
    return await request.download({ url: `/keyboard/user-themes/export-excel`, params })
  }
}