import initCtx from "@/utils/ctx.js";

export default function () {
	const {utils, Tea} = initCtx(this)

	this.serverType = this.serverTypes[0].code

	this.enableTCP = false
	this.enableTLS = false
	this.enableUDP = false

	this.family = ""

	this.changeServerType = function () {
		switch (this.serverType) {
			case "tcpProxy":
				this.family = "tcp"
				this.enableUDP = false
				break
			case "udpProxy":
				this.family = "udp"
				this.enableTCP = false
				this.enableTLS = false
				break
		}
		if (this.$refs != null) {
			this.$refs.originInputBox.changeFamily(this.family)
		}
	}

	this.changeServerType()

	this.success = this.$NotifySuccess("保存成功", "/lb")
}