--[==[
To inspect the content of this data module, use [[Special:ExpandTemplates]]
and enter the following input text:
  {{#invoke:Road data/dump|dump|module=Module:<name-of-this-module>}}

To inspect the content of this data module when editing, enter the following
into the Debug console:
  local util = require("Module:Road data/util")
  print(util.arrayToString(p))
To inspect a particular route type, change `p` above to include the route type,
e.g., `p.I` and `p["US-Hist"]`.
]==]

-- Illinois
local IL = {}

local util = require("Module:Road data/util")
local format = mw.ustring.format
util.addAll(IL, require("Module:Road data/strings/USA"))

local suffix = " ([dab||%dab%, |]Illinois)"

IL.I.link = {
	["39"] = "Interstate 39",
	["41"] = "Interstate 41",
	["44"] = "Interstate 44 in Missouri",
	["72"] = "Interstate 72",
	["88"] = "Interstate 88 (Illinois)",
	["172"] = "Interstate 172",
	["255"] = "Interstate 255",
	["270"] = "Interstate 270 (Missouri–Illinois)",
	["280"] = "Interstate 280 (Iowa–Illinois)",
	["294"] = "Interstate 294",
	["355"] = "Interstate 355",
	["474"] = "Interstate 474",
	default = {
		hook = "split",
		split = 100,
		above = "Interstate %route% (Illinois)",
		below = "Interstate %route% in Illinois"
	}
}

for k, v in pairs(IL) do if k:find ("^I") then 
	v.link = IL.I.link
	end
end

IL.BL.link = IL.I.base .. " Business" .. suffix

for k, v in pairs(IL) do if k:find ("^BL") then 
	v.link = IL.BL.link
	end
end

IL.US.shieldmain = {
	["60"] = {"US 60.svg", "US 62.svg"},
	default = "US %route%.svg"
}
IL.US.name = {
	["60"] = "U.S. Route 60 and U.S. Route 62",
	default = IL.US.base
}
IL.US.link = "U.S. Route %route% in Illinois"

for k, v in pairs(IL) do if k:find ("^US %d") then 
	v.link = IL.US.link
	end
end

for _,auxType in ipairs({"Alt", "Bus", "Byp", "City", "Conn", "Emerg", "Opt", "Scenic", "Spur", "Temp", "Toll", "Truck"}) do
	local spec = IL[" aux "][auxType]
		for k, v in pairs(IL) do if k:find (auxType) then if k:find ("^US") then
			v.link = IL.US.base .. " " .. spec.name .. suffix
			end
		end
	end
end

for _,type in ipairs({'US 1961'}) do
	for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Opt", "Scenic", "Spur", "Temp", "Toll", "Truck"}) do
		local spec = IL[" aux "][auxType]
		IL[type .. "-" .. auxType] = {
			shield = IL[type].shield,
			name = IL.US.name.default .. " " .. spec.name,
			link = IL.US.base .. " " .. spec.name .. suffix,
			abbr = IL.US.abbr .. " " .. spec.abbrsuffix,
			banner = spec.bannerprefix .. " plate 1971.svg",
			aux = spec.aux,
			width = "expand",
		}
	end
end

IL["US 1926-Temp"] = {
	shield = IL["US 1926"].shield,
	shieldmain = "US %route% Temporary 1926.svg",
	name = "Temporary " .. IL.US.name.default,
	link = "U.S. Route %route% Temporary ([dab||%dab%, |]Illinois)",
	abbr = "Temp. US&nbsp;%route%",
	width = "square"
}
IL["US 1961-Toll"].name = "Toll " .. IL.US.name.default

IL["US 1961-Toll-Bus"] = {
	shield = IL["US 1961"].shield,
	name = "Toll " .. IL.US.name.default .. " Business",
	link = "U.S. Route %route% Toll Business ([dab||%dab%, |]Illinois)",
	abbr = "Toll US&nbsp;%route% Bus. ",
	banner = "Toll-business plate.svg",
	width = "square"
}

IL["US-Hist"].link = IL.US.link

IL.IL = {
	shield = "Illinois %route%.svg",
	name = "Illinois Route %route%",
	link = "Illinois Route %route%",
	abbr = "IL&nbsp;%route%",
	width = "expand"
}

for _,year in ipairs({"1926", "1950", "1960"}) do
	IL["IL " .. year] = {
		shield = format("Illinois %%route%% (%s).svg", year),
		name = IL.IL.name,
		link = IL.IL.link,
		abbr = IL.IL.abbr,
		orientation = "upright"
	}
end
IL["IL 1924"] = IL["IL 1926"]

for _,type in ipairs({'IL', 'IL 1960'}) do
	for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Opt", "Scenic", "Spur", "Temp", "Toll", "Truck"}) do
		local spec = IL[" aux "][auxType]
		IL[type .. "-" .. auxType] = {
			shield = IL[type].shield,
			name = IL.IL.name .. " " .. spec.name,
			link = IL.IL.name .. " " .. spec.name .. IL[" dab "],
			abbr = IL.IL.abbr .. " " .. spec.abbrsuffix,
			banner = spec.bannerprefix .. " plate.svg",
			aux = spec.aux,
			width = "expand",
		}
	end
end
IL["IL-Toll"].banner = "Toll plate yellow.svg"

IL.CKC = {
	shield = "Illinois 110.svg",
	name = "Chicago–Kansas City Expressway",
	link = "Chicago–Kansas City Expressway",
	abbr = "IL&nbsp;110 (CKC)",
	banner = "Chicago-Kansas City Expressway plate.svg",
	width = "square"
}

-- add new types above this line if you want it to have the state highway browse and maint
for k, v in pairs(IL) do if k:find ("^%a") then
	v.maint = "[[Illinois Department of Transportation|IDOT]]"
	v.browse = "[[Illinois State Highway System]]"
	v.browselinks = {
		[1] = "[[List of Interstate Highways in Illinois|Interstate]]",
		[2] = "[[List of U.S. Highways in Illinois|US]]",
		[3] = "[[List of state routes in Illinois|State]]",
		[4] = "[[Illinois State Toll Highway Authority|Tollways]]"
	}
	end
end

for k, v in pairs(IL) do if k:find ("Toll$") then 
	v.maint = "[[Illinois State Toll Highway Authority|ISTHA]]"
	end
end

IL.Skyway = {
	shield = "Chicago Skyway logo.svg",
	name = "Chicago Skyway",
	link = "Chicago Skyway",
	abbr = "Chicago Skyway",
	bannersuffix = "blue",
	maint = "Skyway Concession Company"
}

IL.Lincoln.link = "Lincoln Highway in Illinois"

IL.LHT = {
	shield = "Lincoln Heritage Trail.png",
	name = "Lincoln Heritage Trail",
	link = "Lincoln Heritage Trail",
	abbr = "Lincoln Heritage Trail [route||(%route%)|]"
}

IL.MGR = {
	shield = "",
	name = "Meeting of the Great Rivers Scenic Route",
	link = "Meeting of the Great Rivers Scenic Route",
	abbr = "Meeting of the Great Rivers"
}

IL.IRR = {
	shield = "",
	name = "Illinois River Road",
	link = "Illinois River Road",
	abbr = "Illinois River Road"
}

IL.CR.link = "County Road %route% ([county||%county% County, |]Illinois)"
IL.CR.maint = ""
IL.CR.browse = "%county% County Roads"
IL.CR.browselinks = ""


IL.IA = {alias = {module = "USA/IA", type = "IA"}}
IL.IN = {alias = {module = "USA/IN", type = "IN"}}
IL.Toll = {alias = {module = "USA/IN", type = "Toll"}}
IL.KY = {alias = {module = "USA/KY", type = "KY"}}
IL.MO = {alias = {module = "USA/MO", type = "MO"}}
IL.WI = {alias = {module = "USA/WI", type = "WI"}}
IL['I-MO'] = {alias = {module = "USA/MO", type = "I"}}

return IL