--[==[
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"]`.
]==]

-- Indiana
local IN = {}

local util = require("Module:Road data/util")
util.addAll(IN, require("Module:Road data/strings/USA"))

local suffix = " ([dab||%dab%, |]Indiana)"
local format = mw.ustring.format

IN.I.link = {
	["164"] = "Interstate 164",
	["265"] = "Interstate 265",
	["275"] = "Interstate 275 (Ohio–Indiana–Kentucky)",
	["294"] = "Interstate 294",
	["465"] = "Interstate 465",
	["469"] = "Interstate 469",
	["865"] = "Interstate 865",
	 default = {
	 	hook = "split",
		split = 100,
		above = "Interstate %route% (Indiana)",
		below = "Interstate %route% in Indiana"
	 	
	 }
	
}

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

IN.US.link = "U.S. Route %route% in Indiana"

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

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

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

IN.SR = {
	shield = "Indiana %route%.svg",
	base = "Indiana State Road %route%",
	name = "State Road %route%",
	link = "Indiana State Road %route% [dab||(%dab%)|]",
	abbr = "SR&nbsp;%route%",
	width = "expand"
	
}
IN.IN = IN.SR

for _,type in ipairs({'SR', 'IN'}) do
	for _,auxType in ipairs({"Bus","Truck"}) do
		local spec = IN[" aux "][auxType]
		IN[type .. "-" .. auxType] = {
			shield = IN[type].shield,
			shieldmain = IN[type].shieldmain,
			name = spec.name .. " " .. IN[type].name,
			link = IN[type].base .. " " .. spec.name .. "[dab|| (%dab%)|]",
			abbr = spec.abbrsuffix .. " " .. IN[type].abbr,
			banner = spec.bannerprefix .. " plate.svg",
			aux = spec.aux,
			width = IN[type].width
		}
	end
end

for _,type in ipairs({'SR', 'IN'}) do
	for _,year in ipairs({"1926", "1948", "1955"}) do
		IN[type .. " " .. year] = {
			shield = format("Indiana %%route%% (%s).svg", year),
			name = IN.SR.name,
			link = IN.SR.link,
			abbr = IN.SR.abbr,
			orientation = "upright"
		}
	end
end
IN["IN 1940"] = IN["SR 1926"]
IN["SR 1940"] = IN["SR 1926"]

IN["SR 1955"].shield = {
	hook = "between",
	lower = 20,
	upper = 99,
	yes = IN.IN.shield,
	no = "Indiana %route% (1955).svg"
}
IN["IN 1955"] = IN["SR 1955"]

-- add new types above this line if you want it to have the state highway maint
for k, v in pairs(IN) do if k:find ("^%a") then
	v.maint = "[[Indiana Department of Transportation|INDOT]]"
	end
end

IN.Lincoln.link = "Lincoln Highway in Indiana"

IN.Toll = {
	shield = "Indiana Toll Road jct.svg",
	shieldmain = {
		hook = "pagename",
		article = "Indiana Toll Road",
 		iftrue = "ITRLogo Color.png",
 		default = "Indiana Toll Road jct.svg"
	},
	name = "Indiana Toll Road",
	link = "Indiana Toll Road",
	abbr = "Indiana Toll Road",
	bannersuffix = "green",
	maint = "[[Indiana Toll Road Concession Company|ITRCC]]",
}
IN.ITR = IN.Toll

IN.CR.shield = {
	arg = "county",
	default    = "CR %route% jct.svg",
	Hendricks      = ""
}
IN.CR.link = {
	["17"] = "[county|Elkhart|County Road 17 (Elkhart County, Indiana)|]",
	default = ""
}
IN.CR.maint = "%county% County Roads"

IN.Airport = {
	shieldmain = "Airport Expressway marker.svg",
	name = "Airport Expressway",
	link = "Airline Expressway (Fort Wayne, Indiana)",
	abbr = "Airline Expressway"
}

IN.IL = {alias = {module = "USA/IL", type = "IL"}}
IN.Skyway = {alias = {module = "USA/IL", type = "Skyway"}}
IN.KY = {alias = {module = "USA/KY", type = "KY"}}
IN.MI = {alias = {module = "USA/MI", type = "M"}}
IN.OH = {alias = {module = "USA/OH", type = "SR"}}

return IN