import request from '@/utils/request'

interface Page {
	page: number
	size: number
	type?: number
	isRead?: 0 | 1 // 0未读1已读
	keyword?: string // 关键词搜索标题Ï
}
export const fetchAllMessageList = (data) => {
	return request({
		url: '/buyer/buyer/message/page',
		method: 'post',
		data
	})
}

// 获取所有未读消息数量
export const fetchAllUnreadMessage = () => {
	return request({
		url: '/buyer/buyer/message/unread-count',
		method: 'get'
	})
}

// 标记单条消息已读
export const markMessageAsRead = (id: number | string) => {
	return request({
		url: `/buyer/buyer/message/${id}/read`,
		method: 'put'
	})
}

// 标记全部消息已读
export const markAllMessagesAsRead = () => {
	return request({
		url: '/buyer/buyer/message/read-all',
		method: 'put'
	})
}
