import request from '@/config/axios'

export const VotingActivityApi = {
	// 查询投票活动分页
	getVotingActivityPage: async (params: any) => {
		return await request.get({ url: `/menduner/system/mde/voting-activity/page`, params })
	},

	// 查询投票活动
	getVotingActivity: async (id: number) => {
		return await request.get({ url: `/menduner/system/mde/voting-activity/get?id=` + id })
	},

	// 获取候选人类型
	getVotingActivityCategories: async (id: number) => {
		return await request.get({ url: `/menduner/system/mde/voting-activity-join-item/categorys?votingActivityId=` + id })
	},

	// 创建投票活动
	createVotingActivity: async (data: any) => {
		return await request.post({ url: `/menduner/system/mde/voting-activity/create`, data })
	},

	// 更新投票活动
	updateVotingActivity: async (data: any) => {
		return await request.put({ url: `/menduner/system/mde/voting-activity/update`, data })
	},

	// 删除投票活动
	deleteVotingActivity: async (id: number) => {
		return await request.delete({ url: `/menduner/system/mde/voting-activity/delete?id=` + id })
	},

	// 查询投票活动候选人分页
	getVotingActivityJoinItemPage: async (params: any) => {
		return await request.get({ url: `/menduner/system/mde/voting-activity-join-item/page`, params })
	},

	// 查询投票活动候选人
	getVotingActivityJoinItem: async (id: number) => {
		return await request.get({ url: `/menduner/system/mde/voting-activity-join-item/get?id=` + id })
	},
	
	// 创建投票活动候选人
	createVotingActivityJoinItem: async (data: any) => {
		return await request.post({ url: `/menduner/system/mde/voting-activity-join-item/create`, data })
	},

	// 更新投票活动候选人
	updateVotingActivityJoinItem: async (data: any) => {
		return await request.put({ url: `/menduner/system/mde/voting-activity-join-item/update`, data })
	},

	// 删除投票活动候选人
	deleteVotingActivityJoinItem: async (id: number) => {
		return await request.delete({ url: `/menduner/system/mde/voting-activity-join-item/delete?id=` + id })
	},
}