--[==[
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 iNElude the route type,
e.g., `p.I` and `p["US-Hist"]`.
]==]

-- Nebraska
local NE = {}

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

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

NE.I.link = {
	["76"] = "Interstate 76 (Colorado–Nebraska)",
	["80"] = "Interstate 80 in Nebraska",
	["80S"] = "Interstate 76 (Colorado–Nebraska)",
	["129"] = "Interstate 129",
	["280"] = "Interstate 680 (Nebraska–Iowa)",
	["480"] = "Interstate 480 (Nebraska–Iowa)",
	["680"] = "Interstate 680 (Nebraska–Iowa)",
	default = "Interstate %route% ([dab||%dab%|Nebraska])"
}

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

NE.BL.link = "Interstate %route% Business ([dab||%dab%, |]Nebraska)"

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

NE.US.name = "U.S. Highway %route%"
NE.US.link = "U.S. Route %route% in Nebraska"

for k, v in pairs(NE) do if k:find ("^US %d") then 
	v.name = NE.US.name
	v.link = NE.US.link
	end
end
NE["US 1961"].shield = "US %route% Nebraska 1963.svg"
NE["US 1963"] = NE["US 1961"]

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

NE.N = {
	bases = "Nebraska Highway %route%",
	shield = "N-%route%.svg",
	name = "State Highway %route%",
	link = "Nebraska Highway %route% [dab||(%dab%)|]",
	abbr = "N-%route%",
	width = "expand"
}
NE.NE = NE.N

for _,year in ipairs({"1926", "1950", "1967"}) do
	NE["N " .. year] = {
		shield = format("N-%%route%% %s.svg", year),
		shieldmain = format("N-%%route%% %s.svg", year),
		name = NE.N.name,
		link = NE.N.link,
		abbr = NE.N.abbr,
		width = "square",
	}
end
NE["NE 1967"] = NE["N 1967"]
NE["NE 1950"] = NE["N 1950"]
NE["NE 1926"] = NE["N 1926"]

NE.Link = {
	shield = "N LINK %route%.svg",
	name = "Connecting Link %route%",
	link = "Nebraska Link %route%",
	abbr = "L-%route%"
}

NE.Rec = {
	shield = "N REC %route%.svg",
	name = "Recreation %route%",
	link = "Nebraska Recreation %route%",
	abbr = "R-%route%",
	color = "hist"
}
	  
NE.Spur = {	shield = "N SPUR %route%.svg",
	name = "Spur %route%",
	link = "Nebraska Spur %route%",
	abbr = "S-%route%"
}

NE["N-Bus"] = {
	shield = NE.N.shield,
	name = NE.N.name .. " Business",
	link = "Nebraska Highway %route% Business [dab||(%dab%)|]",
	abbr = NE.N.abbr.." Bus.",
	banner = "Business plate.svg",
	aux = NE[" aux "].Bus,
	width = "expand"
}
	
NE["NE-Bus"] = NE["N-Bus"]

-- add new types above this line if you want it to have the state highway browse and maint
for k, v in pairs(NE) do if k:find ("^%a") then
	v.maint = "[[Nebraska Department of Transportation|NDOT]]"
	v.browse = "[[Nebraska State Highway System]]"
	v.browselinks = {
		[1] = "[[List of Interstate Highways in Nebraska|Interstate]]",
		[2] = "[[List of U.S. Highways in Nebraska|US]]",
		[3] = "[[List of state highways in Nebraska|State]]",
		[4] = "[[List of Nebraska Connecting Link, Spur, and Recreation Highways|Link]]",
		[5] = "[[List of Nebraska Connecting Link, Spur, and Recreation Highways|Spur]]",
		[6] = "[[List of state spur highways in Nebraska|State Spurs]]",
		[7] = "[[List of Nebraska Connecting Link, Spur, and Recreation Highways|Recreation]]"
	}
	end
end

for k, v in pairs(NE) do if k:find ("^N%a* %d") then 
	v.maint = "[[Nebraska Department of Roads]]"
	end
end

NE.SS = {
	shield = "Nebraska State Spur %route%.svg",
	name = "Spur %route%",
	link = "Nebraska State Spur %route%",
	abbr = "Spur %route%",
	width = "wide",
	maint = NE["N 1967"].maint
} -- For secondary roads before the spur/link system

NE.CO = {alias = {module = "USA/CO", type = "SH"}}
NE.IA = {alias = {module = "USA/IA", type = "IA"}}
NE.KS = {alias = {module = "USA/KS", type = "K"}}
NE.MO = {alias = {module = "USA/MO", type = "MO"}}
NE.SD = {alias = {module = "USA/SD", type = "SD"}}
NE.WY = {alias = {module = "USA/WY", type = "WY"}}

return NE