AIGameSettingControls.WorkPhase3 = class extends AIGameSettingControlInt
{
	constructor(...args)
	{
		super(...args);
		this.defaultValue = 150;
		g_GameSettings.playerAI.watch(() => this.render(), ["values"]);
	}

	onOpenPage(playerIndex, enabled)
	{
		super.onOpenPage(playerIndex, enabled);
		this.render();
	}

	render()
	{
		const ai = g_GameSettings.playerAI.get(this.playerIndex);
		this.setHidden(!ai);
		if (ai)
		{
			const value = ai.economy?.workPhase3 ?? this.defaultValue;
			this.setIntValue(value);
		}
	}

	onValueChange(value)
	{
		const ai = g_GameSettings.playerAI.get(this.playerIndex);
		const economy = ai && ai.economy ? { ...ai.economy, "workPhase3": value } : { "workPhase3": value };
		g_GameSettings.playerAI.setEconomy(this.playerIndex, economy);
		this.gameSettingsController.setNetworkInitAttributes();
	}
};

AIGameSettingControls.WorkPhase3.prototype.TitleCaption =
	translate("Work Phase 3");
