import request from '../utils/request'

const api = {
  ArticleCategories: '/Article/Categories',
  ArticleList: '/Article/List',
  Article: '/Article',
  AdminArticleList: '/Admin/Article/List',
  AdminArticle: '/Admin/Article',
  AdminArticlePublic: '/Admin/Article/Public',
  AdminCategoryList: '/Admin/Article/Category/List',
  AdminCategory: '/Admin/Article/Category'
}

export function getArticleCategories() {
  return request({ url: api.ArticleCategories, method: 'get' })
}

export function getArticleList(params) {
  return request({ url: api.ArticleList, method: 'get', params })
}

export function getArticle(params) {
  return request({ url: api.Article, method: 'get', params })
}

export function getAdminArticleList(params) {
  return request({ url: api.AdminArticleList, method: 'get', params })
}

export function getAdminArticle(params) {
  return request({ url: api.AdminArticle, method: 'get', params })
}

export function saveAdminArticle(data) {
  return request({ url: api.AdminArticle, method: 'post', data })
}

export function deleteAdminArticle(data) {
  return request({ url: api.AdminArticle, method: 'delete', data })
}

export function toggleAdminArticlePublic(data) {
  return request({ url: api.AdminArticlePublic, method: 'post', data })
}

export function getAdminCategoryList(params) {
  return request({ url: api.AdminCategoryList, method: 'get', params })
}

export function saveAdminCategory(data) {
  return request({ url: api.AdminCategory, method: 'post', data })
}

export function deleteAdminCategory(data) {
  return request({ url: api.AdminCategory, method: 'delete', data })
}
