import {post} from "@/service/request.ts";

export function getAllCategory() {
	return post<{ tags: ArticleCategory[] }>({url: '/spider/tags'})
}

export function getList(data: ApiArticleSearchParams) {
	return post<DataList<ListArticleItem>>({url: '/article/search', data})
}

/**
 * 删除 【本期不做】
 * @param id
 */
export function deleteByIds(article_ids: Id[]) {
	return post('/article/remove',{article_ids})
}

export function getById(id: Id) {
	return post<ArticleDetail>({url: '/article/detail/' + id})
}

export function save(title: string, metahuman_text: string, content_group: BlockContent[][], id?: number) {
	return post<{ content: string }>(id && id > 0 ? '/article/modify' : '/article/create/new', {
		title,
		metahuman_text,
		content_group,
		id
	})
}

export function push2video(article_ids: Id[]) {
	return post('/article/push2video', {article_ids})
}