/** 訊息框相關 */
export default class CSMessage {
	private static _client: any;
	public static Initialize(client: any): void {
		this._client = client;
	}

	/** 一個按鈕的訊息框 */
	public static CreateYesMsg(content: string, yesCallback: () => void = null, enterStr: string = null) {
		// enterStr = enterStr ? enterStr : CSSettingsV3.prototype.CommonString(3);
		// let data: MessageNormalData = {
		// 	content: content,
		// 	isShowCancel: false,
		// 	yesCallback: yesCallback,
		// 	noCallback: null,
		// 	enterName: enterStr,
		// 	cancelName: null
		// };
		// MessageNormal.Create(this._sourceUI, this._parent, data);
	}

	/** 兩個按鈕的訊息框 */
	public static CreateYesNoMsg(content: string, yesCallback: () => void = null, noCallback: () => void = null, enterStr: string = null, cancelStr: string = null) {
		this._client.isLoading.value = false;
		this._client.Popup.content.value = content;
		if (yesCallback) {
			this._client.Popup.yesCallback = yesCallback;
		}
		if (noCallback) {
			this._client.Popup.noCallback = noCallback;
		}
		if (enterStr) {
			this._client.Popup.enterStr.value = enterStr;
		}
		if (cancelStr) {
			this._client.Popup.cancelStr.value = cancelStr;
		}
		this._client.PopupVisible.value = true;
		// enterStr = enterStr ? enterStr : CSSettingsV3.prototype.CommonString(3);
		// cancelStr = cancelStr ? cancelStr : CSSettingsV3.prototype.CommonString(4);
		// let data: MessageNormalData = {
		// 	content: content,
		// 	isShowCancel: true,
		// 	yesCallback: yesCallback,
		// 	noCallback: noCallback,
		// 	enterName: enterStr,
		// 	cancelName: cancelStr
		// };
		// MessageNormal.Create(this._sourceUI, this._parent, data);
	}

	/** 網路錯誤訊息 */
	public static NetError(method: string, state: number, str: string = ""): void {
		let error: string = String.Format("[{0}] state:{1} {2}", method, state, str);
		console.warn("網路錯誤訊息: ", error);
	}
}