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

-- Mississippi
local MS = {}

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

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

MS.I.link = {
	["14"] = "Interstate 14",
	["22"] = "Interstate 22",
	["269"] = "Interstate 269",
	default = {hook = "splitlen",
		split = 3,
		above = "Interstate %route% (Mississippi)",
		below = "Interstate %route% in Mississippi"
	}
}

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

MS.US.name = "U.S. Highway %route%"
MS.US.link = "U.S. Route %route% in Mississippi"

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

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

MS.MS = {
	shield = {
		hook = "splitlen",
		split = 3,
		above = "Ellipse sign %route%.svg",
		below = {
			hook = "split",
			split = 20,
			above = "Elongated circle %route%.svg",
			below = "Ellipse sign %route%.svg"
		}
	},
	base = "Mississippi Highway %route%",
	name = "Mississippi Highway %route%",
	link = "Mississippi Highway %route%[dab|| (%dab%)|]",
	abbr = "MS&nbsp;%route%",
	width = "expand"}

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

MS["MS-Scenic"].shield = "Ellipse sign %route% blue.svg"
MS["MS-Scenic"].shieldmain = MS["MS-Scenic"].shield
MS["MS-Scenic"].banner = "Scenic Route plate blue.svg"
MS["MS-Scenic"].bannersuffix = "blue"
	
MS.FR.shield = ""
MS.FR.link = ""

MS["MS 1960"] = {
	shield = "Mississippi %route%.svg",
	name = MS.MS.name,
	link = MS.MS.link,
	abbr = MS.MS.abbr,
	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(MS) do if k:find ("^%a") then
	v.maint = "[[Mississippi Department of Transportation|MDOT]]"
	end
end

MS.AL = {alias = {module = "USA/AL", type = "SR"}}

return MS