import { requestClient } from '#/api/request';

export interface ActivityData {
    id: number;
    type: number;
    title?: string;
    mail_title?: string;
    mail_content?: string;
    start_time: number;
    end_time: number;
    level?: number;
    cfg?: string;
    extra?: string;
    tag?: string;
    interval?: number;
    now_start_time?: number;
    now_end_time?: number;
}

export interface ActivityListParam {
    AppId : number;
    ServerId: number;
    PageSize: number;
    CurrentPage: number;
    activityType?: number;
}

export interface EditActivityParam {
    AppId : number;
    Cfg : ActivityData;
}

export interface ResgetActivityListApi{
    total: number;
    data: ActivityData[];
}

export interface SyncActivityParam {
    SrcAppId : number;
    DstAppId : number;
}
export async function syncActivityApi(p: SyncActivityParam) {
    return requestClient.post('/activity/sync', p);
}

export async function getActivityListApi(p:ActivityListParam) {
    return requestClient.post<ResgetActivityListApi>('/activity/list', p);
}

export async function editActivityApi(p: EditActivityParam) {
    return requestClient.post('/activity/edit', p);
}

export async function addActivityApi(p: EditActivityParam) {
    return requestClient.post('/activity/add', p);
}

