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

-- Maryland
local MD = {}

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

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

MD.I.link = {
	["68"] = "Interstate 68",
	["97"] = "Interstate 97",
	["295"] = "Interstate 295 (Maryland–District of Columbia)",
	["370"] = "Interstate 370",
	["495"] = "Interstate 495 (Capital Beltway)",
	["495X"] = "Cabin John Parkway",
	default = {
		hook = "split",
		split = 100,
		above = "Interstate %route% (Maryland)",
		below = "Interstate %route% in Maryland"
	}
}

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


MD["I-Spur"].link = "Interstate %route% Spur (Maryland)"
	
MD["I-Express"].link = "Interstate %route% Express (Maryland)"
MD["I-Express"].banner = "Toll plate yellow.svg"

MD.US.link = "U.S. Route %route% in Maryland"

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

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

for _,auxType in ipairs({"Bus"}) do
	local spec = MD[" aux "][auxType]
		for k, v in pairs(MD) do if k:find (auxType) then if k:find ("^US") then
			v.shield = "US %route% Business (MD).svg"
			v.link = MD.US.base .. " " .. spec.name .. " ([dab||%dab%, |]Maryland)"
			v.banner = ""
			v.bannersuffix = "Vermont"
			end
		end
	end
end

MD["US 1926-Alt"] = {
	shield = MD["US 1926"].shield,
	shieldmain = MD["US 1926"].shieldmain,
	name = MD["US-Alt"].name,
	link = MD["US-Alt"].link,
	abbr = MD["US-Alt"].abbr,
	banner = "Alternate plate 1927.svg",
	nbrowse = MD["US 1926"].nbrowse,
	nbrowselinks = MD["US 1926"].nbrowselinks
}
	 
MD.SR = {
	base = "Maryland Route %route%",
	shield = "MD Route %route%.svg",
	name = "Maryland Route %route%",
	link = "Maryland Route %route% [dab||(%dab%)|]",
	abbr = "MD %route%",
	width = "expand"
	
}
MD.MD = MD.SR

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

for _,type in ipairs({'SR', 'MD'}) do
	for _,auxType in ipairs({"Bus"}) do
		local spec = MD[" aux "][auxType]
		MD[type .. "-" .. auxType] = {
	shield = "MD Route %route% Business.svg",
	name = MD.SR.name .. " " .. spec.name,
	link = MD.SR.base .. " " .. spec.name .. MD[" dab "],
	abbr = MD.SR.abbr .. " " .. spec.abbrsuffix,
	aux = spec.aux,
	bannersuffix = "Vermont",
	width = "expand",
		}
	end
end

MD.BWP = {
	shield = "",
	name = "Baltimore–Washington Parkway",
	link = "Baltimore–Washington Parkway",
	abbr = "Baltimore–Washington Parkway"
}

MD.CBP = {
	shield = "",
	name = "Clara Barton Parkway",
	link = "Clara Barton Parkway",
	abbr = "Clara Barton Parkway"
}

MD.CJP = {
	shield = "",
	name = "Cabin John Parkway",
	link = "Cabin John Parkway",
	abbr = "Cabin John Parkway"
}

MD.COC = {
	shield = "MD scenic byway.svg",
	name = "Chesapeake and Ohio Canal Scenic Byway",
	link = "Chesapeake and Ohio Canal Scenic Byway",
	abbr = "C&O Canal Scenic Byway",
}

MD.SB = {
	shield = {
		default = "MD scenic byway.svg",
		["1"] = "MUTCD D6-4.svg",
		["5"] = "MUTCD D6-4.svg",
		["11"] = "MUTCD D6-4.svg",
		["16"] = "MUTCD D6-4.svg",
		["17"] = {"MUTCD D6-4.svg", "MD scenic byway.svg"},
		["18"] = "MUTCD D6-4.svg",
	},
	name = {
		arg = "route",
		["1"] = "&#35;1: Historic National Road",
		["2"] = "&#35;2: Mountain Maryland",
		["3"] = "&#35;3: Chesapeake and Ohio Canal",
		["4"] = "&#35;4: Antietam Campaign",
		["5"] = "&#35;5: Journey Through Hallowed Ground",
		["6"] = "&#35;6: Old Main Streets",
		["7"] = "&#35;7: Mason and Dixon",
		["8"] = "&#35;8: Falls Road",
		["9"] = "&#35;9: Horses and Hounds",
		["10"] = "&#35;10: Lower Susquehanna",
		["11"] = "&#35;11: Charles Street",
		["12"] = "&#35;12: National Historic Seaport",
		["13"] = "&#35;13: Star-Spangled Banner",
		["14"] = "&#35;14: Booth's Escape",
		["15"] = "&#35;15: Roots and Tides",
		["16"] = "&#35;16: Religious Freedom",
		["17"] = "&#35;17: Chesapeake Country",
		["18"] = "&#35;18: Harriet Tubman Underground Railroad",
		["19"] = "&#35;19: Cape to Cape"
	},
	link = "List of Maryland Scenic Byways",
	abbr = {
		arg = "route",
		["1"] = "&#35;1: Historic National Road",
		["2"] = "&#35;2: Mountain Maryland",
		["3"] = "&#35;3: Chesapeake and Ohio Canal",
		["4"] = "&#35;4: Antietam Campaign",
		["5"] = "&#35;5: Journey Through Hallowed Ground",
		["6"] = "&#35;6: Old Main Streets",
		["7"] = "&#35;7: Mason and Dixon",
		["8"] = "&#35;8: Falls Road",
		["9"] = "&#35;9: Horses and Hounds",
		["10"] = "&#35;10: Lower Susquehanna",
		["11"] = "&#35;11: Charles Street",
		["12"] = "&#35;12: National Historic Seaport",
		["13"] = "&#35;13: Star-Spangled Banner",
		["14"] = "&#35;14: Booth's Escape",
		["15"] = "&#35;15: Roots and Tides",
		["16"] = "&#35;16: Religious Freedom",
		["17"] = "&#35;17: Chesapeake Country",
		["18"] = "&#35;18: Harriet Tubman Underground Railroad",
		["19"] = "&#35;19: Cape to Cape"
	}
}

-- add new types above this line if you want it to have the state highway browse and maint
for k, v in pairs(MD) do if k:find ("^%a") then
	v.maint = "[[Maryland State Highway Administration|MDSHA]]"
	end
end

MD.Pkwy = {
	shield = "",
    name = "%route% Parkway", 
    link = "%route% Parkway", 
    abbr = "%route% Parkway", 
    color = "hist",
	maint = "[[National Park Service|NPS]]"
}

MD.MDJFK = {
	shield = "MD JFK Highway.svg",
	name = "John F. Kennedy Memorial Highway",
	link = "John F. Kennedy Memorial Highway (Maryland)",
	abbr = "JFK Memorial Highway",
	maint = "[[Maryland Transportation Authority]]"
}

for k, v in pairs(MD) do if k:find ("Toll$") then 
	v.maint = MD.MDJFK.maint
	end
end

MD.CR.maint = ""

MD.PA = {alias = {module = "USA/PA", type = "PA"}}
MD.WV = {alias = {module = "USA/WV", type = "WV"}}
MD.VA = {alias = {module = "USA/VA", type = "SR"}}
MD.DEMD = {alias = {module = "USA/DE", type = "DEMD"}}

return MD