import { request } from '/@/utils/service'
import { UserPageQuery, AddReq, DelReq, EditReq, InfoReq } from '@fast-crud/fast-crud'

export const apiPrefix = '/api/ad_manage/sdgroups/report/trend/'
export function GetList(query: UserPageQuery) {
	return request({
		url: '/api/ad_manage/sdgroups/',
		method: 'get',
		params: query,
	})
}
export function GetObj(id: number) {
	return request({
		url: apiPrefix + id + '/',
		method: 'get',
	})
}

export function AddObj(obj: AddReq) {
	return request({
		url: apiPrefix,
		method: 'post',
		data: obj,
	})
}

export function UpdateObj(obj: EditReq) {
	return request({
		url: apiPrefix + obj.id + '/',
		method: 'put',
		data: obj,
	})
}

export function DelObj(id: DelReq) {
	return request({
		url: apiPrefix + id + '/',
		method: 'delete',
		data: { id },
	})
}

export function getCardData(query: UserPageQuery) {
	return request({
		url: '/api/ad_manage/sdgroups/report/amount',
		method: 'GET',
		params: query,
	})
}

export function getLineData(query: UserPageQuery) {
	return request({
		url: apiPrefix + 'daily',
		method: 'GET',
		params: query,
	})
}

export function getLineWeekData(query: UserPageQuery) {
	return request({
			url: apiPrefix + "weekly",
			method: 'GET',
			params: query
	})
}

export function getLineMonthData(query: UserPageQuery) {
	return request({
			url: apiPrefix + 'monthly',
			method: 'GET',
			params: query
	})
}