import { Config } from "~/config";
import { TEAM } from "../team/team-constants";

export const TOURNAMENT = {
	TEAM_NAME_MAX_LENGTH: TEAM.NAME_MAX_LENGTH,
	COUNTERPICK_MAPS_PER_MODE: 2,
	COUNTERPICK_MAX_STAGE_REPEAT: 2,
	COUNTERPICK_ONE_MODE_TOURNAMENT_MAPS_PER_MODE: 6,
	AVAILABLE_BEST_OF: [1, 3, 5, 7, 9] as const,
	ENOUGH_TEAMS_TO_START: 2,
	MIN_GROUP_SIZE: 3,
	MAX_GROUP_SIZE: 6,
	MAX_BRACKETS_PER_TOURNAMENT: 10,
	BRACKET_NAME_MAX_LENGTH: 32,
	PLACEMENT_MAX: 100,
	// just a fallback, normally this should be set by user explicitly
	RR_DEFAULT_TEAM_COUNT_PER_GROUP: 4,
	RR_TEAMS_PER_GROUP_OPTIONS: [3, 4, 5, 6],
	RR_AB_DIVISIONS_TEAMS_PER_GROUP_OPTIONS: [4, 6, 8, 10, 12],
	SWISS_DEFAULT_GROUP_COUNT: 1,
	SWISS_DEFAULT_ROUND_COUNT: 5,
	SE_DEFAULT_HAS_THIRD_PLACE_MATCH: true,
	MAX_SAVED_COUNT: 20,
	/** How many days after a tournament ends VOD links are shown on the bracket */
	VOD_VISIBILITY_DAYS: 7,
	ROUND_NAMES: {
		WB_FINALS: "WB Finals",
		GRAND_FINALS: "Grand Finals",
		BRACKET_RESET: "Bracket Reset",
		FINALS: "Finals",
		LB_FINALS: "LB Finals",
		LB_SEMIS: "LB Semis",
		THIRD_PLACE_MATCH: "3rd place match",
		FINALS_THIRD_PLACE_MATCH_UNIFIED: "Finals + 3rd place match",
	},
} as const;

export const LEAGUES =
	process.env.NODE_ENV === "development" && !Config.prodMode
		? {
				LUTI: [
					{
						tournamentId: 6,
						weeks: [
							{
								weekNumber: 2,
								year: 2025,
							},
							{
								weekNumber: 3,
								year: 2025,
							},
							{
								weekNumber: 4,
								year: 2025,
							},
						],
					},
				],
			}
		: {
				LUTI: [
					{
						tournamentId: 1066,
						weeks: [
							{
								weekNumber: 10,
								year: 2025,
							},
							{
								weekNumber: 11,
								year: 2025,
							},
							{
								weekNumber: 12,
								year: 2025,
							},
							{
								weekNumber: 13,
								year: 2025,
							},
							{
								weekNumber: 14,
								year: 2025,
							},
						],
					},
					{
						tournamentId: 3192,
						weeks: [
							{
								weekNumber: 9,
								year: 2026,
							},
							{
								weekNumber: 10,
								year: 2026,
							},
							{
								weekNumber: 11,
								year: 2026,
							},
							{
								weekNumber: 12,
								year: 2026,
							},
							{
								weekNumber: 13,
								year: 2026,
							},
						],
					},
				],
			};
