import request from "@/utils/request";
const { api } = process.env.CONFIG;


export interface CreateLandingPageProps {
    name: string,
    content: string,
    qrCodeList: string[],
    projectGroupIdList: number[],
    remark?: string
}
/**
 * 新增落地页
 * @param data 
 * @returns 
 */
export function createLandingPageApi(data: CreateLandingPageProps) {
    return request({
        url: api + `/corpOperation/landing/page/create`,
        method: 'POST',
        data
    })
}

/**
 * 删除落地页
 * @param data 
 * @returns 
 */
export function delLandingPageApi(params: { idList: number[] }) {
    return request({
        url: api + `/corpOperation/landing/page/delete`,
        method: 'DELETE',
        params
    })
}

export interface EditLandingPageProps extends CreateLandingPageProps {
    id: number
}
/**
 * 修改
 * @param data 
 * @returns 
 */
export function editLandingPageApi(data: EditLandingPageProps) {
    return request({
        url: api + `/corpOperation/landing/page/update`,
        method: 'POST',
        data
    })
}

export interface GetLandingPageListProps {
    pageNum: number,
    pageSize: number,
    name?: string,
    startTime?: string,
    endTime?: string,
    remark?: string,
    projectGroupIdList?: number[]
    bookName?: string
    corpId?: string,
    corpUserIdList?: string[]
}

/**
 * 查询落地页列表
 * @param data 
 * @returns 
 */
export function getLandingPageListApi(data: GetLandingPageListProps) {
    return request({
        url: api + `/corpOperation/landing/page/listOfPage`,
        method: 'POST',
        data
    })
}