const TradingConditionValidator = {
	validate(strategyId, symbolRoot, contractMonth, multiplier) {
		if (symbolRoot === "") {
			alert("請選擇商品");
			document.getElementById(`IsActivated-${strategyId}`).checked = false;
			return false;
		}

		if (contractMonth === "") {
			alert("請選擇合約月份");
			document.getElementById(`IsActivated-${strategyId}`).checked = false;
			return false;
		}

		if (Number(multiplier) > multiplierLimitation.max) {
			alert(`跟單倍數不得大於 ${multiplierLimitation.max} 倍`);
			document.getElementById(`IsActivated-${strategyId}`).checked = false;
			multiplier.value = multiplierLimitation.max;
			multiplier.focus();
			return false;
		}

		if (Number(multiplier) < multiplierLimitation.min) {
			alert(`跟單倍數不得小於 ${multiplierLimitation.min} 倍`);
			document.getElementById(`IsActivated-${strategyId}`).checked = false;
			multiplier.value = multiplierLimitation.min;
			multiplier.focus();
			return false;
		}

		if (Number(multiplier) === 0) {
			alert(`跟單倍數不得為 0`);
			document.getElementById(`IsActivated-${strategyId}`).checked = false;
			multiplier.value = 1;
			multiplier.focus();
			return false;
		}

		return true;
	},
};
