/**
 * 笔记相关接口
 */

import request from '@/utils/request'
import qs from 'qs'
const baseUrl = '/v1/api'

export const getBookMarkList = params => {
    return request({
        url: baseUrl + '/doc/bookmark/mine',
        method: 'get',
        params
    })
}
// 根据文章获取笔记
export const getBookMark = params => {
    return request({
        url: baseUrl + '/doc/bookmark',
        method: 'get',
        params
    })
}

export const getBookMarkByTag = params => {
    return request({
        url: baseUrl + '/doc/bookmark/tag',
        method: 'get',
        params
    })
}

export const removeMark = data => {
    return request({
        url: baseUrl + '/doc/bookmark/delete',
        method: 'post',
        data
    })
}

export const pdfRemoveMark = data => {
    return request({
        url: baseUrl + '/doc/bookmark/pdf/delete',
        method: 'post',
        data
    })
}

// 新增和编辑笔记-doc
export const addOrUpdateNoteDoc = data => {
    return request({
        url: baseUrl + '/doc/bookmark/addOrUpdate',
        method: 'post',
        data
    })
}

// 新增和编辑笔记-pdf
export const addOrUpdateNotePdf = data => {
    return request({
        url: baseUrl + '/doc/bookmark/pdf/addOrUpdate',
        method: 'post',
        data
    })
}

// 删除笔记
export const deleteNote = data => {
    return request({
        url: baseUrl + '/doc/bookmark/delete',
        method: 'post',
        data: qs.stringify(data),
        headers: { 'content-type': 'application/x-www-form-urlencoded' }
    })
}
