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

// =======================================================================================
/** 通用回傳SERVER創的遊戲帳號 */
export interface CommonAccountResponse {
	id: string;
	pw: string;
}
// =======================================================================================
/** 電話確認 */
export class PhoneCheck extends NetRequest<PhoneCodeRequest, string> {
	get Method(): string {
		return "register.phone_check";
	}
	constructor(p: string) {
		super();
		this.Data = {
			p: p
		};
	}
}
/** 電話驗證 */
export interface PhoneCodeRequest {
	p: string;
}

export class PhoneCode extends NetRequest<PhoneCodeRequest, string> {
	get Method(): string {
		return "register.phone_code";
	}
	constructor(p: string) {
		super();
		this.Data = {
			p: p
		};
	}
}

export interface PhoneBindRequest {
	c: string;
}

export class PhoneBind extends NetRequest<PhoneBindRequest, string> {
	get Method(): string {
		return "register.phone_bind";
	}
	constructor(c: string) {
		super();
		this.Data = {
			c: c
		};
	}
}

// =======================================================================================
/** 旗標更新 */
export class FlagOpenAdd extends NetRequest<number, string> {
	get Method(): string {
		return "flag.open_add";
	}
	constructor(type: number) {
		super();
		this.Data = type;
	}
}

// ========================================================================================
export interface ForgotInfo {
	a: string;
	p: string;
}

/** 忘記密碼 */
export class ForgotPassword extends NetRequest<ForgotInfo, null> {
	get Method(): string {
		return "register.account_forget";
	}
	constructor(account: string, phone: string) {
		super();
		this.Data = {
			a: account,
			p: phone,
		};
	}
}

export interface ChangePasswordInfo {
	a: string;
	opw: string;
	pw: string;
}

/** 修改密碼 */
export class ChangePassword extends NetRequest<ChangePasswordInfo, null> {
	get Method(): string {
		return "register.account_change";
	}
	constructor(account: string, prePassword: string, password: string) {
		super();
		this.Data = {
			a: account,
			opw: prePassword,
			pw: password
		};
	}
}

// =======================================================================================
export interface LineBindResponse {
	n: string;
}

export class LineBind extends NetRequest<string, LineBindResponse> {
	get Method(): string {
		return "register.line_bind";
	}
	constructor(token: string) {
		super();
		this.Data = token;
	}
}
/** LINE登入(回傳SERVER帳號) */
export class LineLoginRequest extends NetRequest<string, CommonAccountResponse> {
	get Method(): string {
		return "register.line_login";
	}
	constructor(token: string) {
		super();
		this.Data = token;
	}
}
// =======================================================================================