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

export interface MailData {
    AppId : number;
    ServerId: number;
    PageSize?: number;
    CurrentPage?: number;
    mail_id?: number;
    title: string;
    subtitle?: string;
    content: string;
    title_en: string;
    subtitle_en?: string;
    content_en: string;
    title_ptbr?: string;
    subTitle_ptbr?: string;
    content_ptbr?: string;
    items : string;
    start_time: number;
    end_time: number;
    register_time: number;
    mail_type: number;
    send_type: number;
    to_uids :string;
    create_time?: number;
    title_es_latam?: string;
    subTitle_es_latam?: string;
    content_es_latam?: string;
}

export interface MailListParam {
    AppId : number;
    ServerId: number;
    PageSize: number;
    CurrentPage: number;
}

export async function getMailListApi(p:MailListParam) {
    return requestClient.post<MailData[]>('/mail/list', p);
}

export async function addMailApi(data:MailData) {
    return requestClient.post('/mail/send', data);
}

export async function deleteMailApi(AppId:number, ServerId:number, mail_id:number) {
    return requestClient.post('/mail/delete', {mail_id:mail_id, AppId:AppId, ServerId:ServerId});
}
