import {get, post, put, del} from '../http/http'
import {uploadImage} from '../http/api/upload'

const article = {
  getArticleTypeOption() {
    return get("article/article-type-select")
  },
  getArticleTypePages(params) {
    return post("article/article-type-pages", params)
  },
  addArticleType(data) {
    return post("article/article-types", data)
  },
  updateArticleType(data) {
    return put("article/article-types", data)
  },
  viewArticleType(articleTypeId) {
    return get("article/article-types/" + articleTypeId)
  },
  deleteArticleType(articleTypeId) {
    return del("article/article-types/" + articleTypeId)
  },
  getArticlePages(params) {
    return post("article/article-pages", params)
  },
  addArticle(data) {
    return post("article/articles", data)
  },
  updateArticle(data) {
    return put("article/articles", data)
  },
  viewArticle(articleId) {
    return get("article/articles/" + articleId)
  },
  deleteArticle(articleId) {
    return del("article/articles/" + articleId)
  },
  deleteArticleImage(imageId) {
    return del("article/article-images/" + imageId)
  },
  deleteArticleLink(linkId) {
    return del("article/article-links/" + linkId)
  },
  uploadImages(data) {
    return uploadImage(data)
  }
}

export default article;