import { NetRequest } from "../../Engine/CatanEngine/NetManagerV2/NetRequest";

// #region Request

export type RpcAdSyncRequest = null
export type RpcAdSyncResponse = [TLobbyAdData[], TPopupAdData[]]

export class AdSyncRequest extends NetRequest<RpcAdSyncRequest, RpcAdSyncResponse> {
	get Method(): string {
		return "ad.sync";
	}
	constructor() {
		super();
	}
}

// #endregion

// #region Type

export type TLobbyAdData = [
	id: number,
	type: AdSyncType,
	priority: number,
	image: string,
	param: TAdParam,
	time: number,
];

export type TPopupAdData = [
	id: number,
	type: AdSyncType,
	priority: number,
	image: string,
	param: TAdParam,
	cond: IPopupAdCond,
	time: number,
	intervalTime: number,
];

export type TAdParam = any[];

// #endregion

// #region Interface

export interface IPopupAdCond {
	/** 每日首次登入 */
	1: number,

	/** 進入大廳 */
	2: number,

	/** 進度大廳且金幣低於1000 */
	3: number,

	/** 在大廳關閉商城頁 */
	4: number,

	/** 離開特定機台跳出 */
	5: number,
}

// #endregion

// #region Enum

export enum AdType {
	/** 大廳 */
	lobby_ad = 1,
	/** 蓋台 */
	inter_ad = 2
}

export enum AdSyncType {
	/** 純廣告 */
	Ad = 1,
	/** 得來購 */
	Dlygo,
	/** 前往商城 */
	Shop,
	/** 指定機台 */
	Slot,
	/** 公告 */
	Announce,
	/** 活動 */
	Activity,
	/** 任務 */
	Task,
	/** 首頁教學 */
	FrontPageTutorial,
	/** 贈禮 */
	Txn,
	/** 排行 */
	Rank,
}

// #endregion