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

-- Ohio
local OH = {}

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

local suffix = " ([dab||%dab%, |]Ohio)"
local suffix2 = " [dab||(%dab%)|]"
local maint = "[[Ohio Department of Transportation|ODOT]]"

OH.I.link = {
	["71"] = "Interstate 71",
	["80S"] = "Interstate 76 in Ohio",
	["271"] = "Interstate 271",
	["275"] = "Interstate 275 (Ohio–Indiana–Kentucky)",
	["470"] = "Interstate 470 (Ohio–West Virginia)",
	["471"] = "Interstate 471",
	["480N"] = "Interstate 480N (Ohio)",
	default = {
		hook = "split",
		split = 100,
		above = "Interstate %route% (Ohio)",
		below = "Interstate %route% in Ohio"
	}
}

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

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

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

OH.US.link = "U.S. Route %route% in Ohio"

OH.USD = {
	shield = OH.US.shield,
	link = OH.US.name .. "D",
	link = "U.S. Route %route%D ([dab||%dab%, Ohio|])",
	abbr = "US&nbsp;%route%D",
	width = "expand"
	
}

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

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

OH["US 1961-Alt"] = {
	shield = OH["US 1961"].shield,
	name = OH["US-Alt"].name,
	link = OH["US-Alt"].link,
	abbr = OH["US-Alt"].abbr,
	banner = OH["US-Alt"].banner,
	aux = OH[" aux "].Alt,
	nbrowse = OH.US.nbrowse,
	nbrowselinks = OH.US.nbrowselinks
}

OH.SR = {
	base = "Ohio State Route %route%",
	shield = "OH-%route%.svg",
	name = "State Route %route%",
	link = "Ohio State Route %route% [dab||(%dab%)|]",
	abbr = "SR&nbsp;%route%",
	width = "expand"
}
OH.OH = OH.SR

for _,type in ipairs({'SR', 'OH'}) do
	for _,auxType in ipairs({"Alt", "Bus", "Byp", "Spur", "Temp", "Truck"}) do
		local spec = OH[" aux "][auxType]
		OH[type .. "-" .. auxType] = {
			shield = OH.SR.shield,
			shieldmain = OH.SR.shield,
			name = OH.SR.name .. " " .. spec.name,
			link = OH.SR.base .. " " .. spec.name .. suffix2,
			abbr = OH.SR.abbr .. " " .. spec.abbrsuffix,
			banner = spec.banneralt .. " plate.svg",
			aux = spec.aux,
			width = "expand",
		}
	end
end
	  
OH["OH ICH"] = {
	shield = "OH-%route% (1912).svg",
	name = "Inter-county Highway %route%",
	link = "Ohio Inter-county Highway %route%",
	abbr = "ICH %route%"
	
}

for _,type in ipairs ({"SR", "OH"}) do
	for _,year in ipairs({"1920", "1927", "1948", "1960", "1967"}) do
		OH[type .. " " .. year] = {
			shield = format("OH-%%route%% (%s).svg", year),
			name = OH.SR.name,
			link = OH.SR.link,
			abbr = OH.SR.abbr,
			width = "square",
		}
	end
end
OH["SR 1967"].shield = {
	hook = "splitlen",
	split = 3,
	above = "OH-%route% (1967).svg",
	below = OH.SR.shield
}
OH["OH 1967"].shield = OH["SR 1967"].shield

OH["SR 1960-Temp"] = {
	shield = OH["SR 1960"].shield,
	name = OH["SR-Temp"].name,
	link = OH["SR-Temp"].link,
	abbr = OH["SR-Temp"].abbr,
	banner = "Temporary plate 1948.svg",
	aux = OH[" aux "].Temp
}
OH["OH 1960-Temp"] = OH["SR 1960-Temp"]
         	
OH.SRD = {
	shield = "OH-%route%.svg",
	name = OH.SR.name .. "D",
	link = "Ohio State Route %route%D [dab||(%dab%)|]",
	abbr = "SR&nbsp;%route%D",
	width = "expand"
	
}
OH.OHD = OH.SRD

OH.SBR = {
	shield = "US Bike %route% (M1-8).svg",
	link = "Ohio State Bike Route %route%",
	abbr = "State Bike Route %route%",
	orientation = "upright"
}  
         
OH.MMR = {
	shield = "RomanNumeral-%route% (OH MMR).svg",
	name = "Main Market Route %route%",
	link = "Ohio Main Market Route %route% [dab||(%dab%)|]",
	abbr = "MMR %route%"
}

OH.OHTP = {
	shield = "OhioTurnpike.svg",
	name = "Ohio Turnpike",
	link = "Ohio Turnpike",
	abbr = "Ohio Turnpike",
	bannersuffix = "Vermont",
	nbrowse = OH.I.nbrowse,
	nbrowselinks = OH.I.browselinks
}

-- add new types above this line if you want it to have the state highway browse and maint
for k, v in pairs(OH) do if k:find ("^%a") then
	v.maint = "[[Ohio Department of Transportation|ODOT]]"
	v.browse = "[[Numbered highways in Ohio|Ohio Highways]]"
	v.browselinks = {
		[1] = "[[List of Interstate Highways in Ohio|Interstate]]",
		[2] = "[[List of U.S. Routes in Ohio|US]]",
		[3] = "[[List of state routes in Ohio|State]]",
		[4] = "[[Ohio Scenic Byways|Scenic]]"
	}
	end
end

OH.OHTP.maint = "[[Ohio Turnpike and Infrastructure Commission]]"

local countyShield = {
	arg			= "county",
	default		= "CR %route% jct (OH).svg",
	Athens		= "CR %route% jct (green).svg",
	Belmont		= "CR %route% jct.svg",
	Columbiana	= "CR %route% jct.svg",
	Guernsey	= "CR %route% jct (green).svg",
	Hardin		= "CR %route% jct (green).svg",
	Henry		= "CR %route% jct (green).svg",
	Holmes		= "CR %route% jct (green).svg",
	Jefferson	= "CR %route% jct.svg",
	Madison		= "CR %route% jct.svg",
	Mahoning	= "CR %route% jct.svg",
	Medina		= "CR %route% jct (blue).svg",
	Monroe		= "CR %route% jct (green).svg",
	Noble		= "CR %route% jct (blue).svg",
	Ottawa		= "CR %route% jct.svg",
	Paulding	= "CR %route% jct (green).svg",
	Scioto		= "Scioto County Route %route% OH.svg",
	Seneca		= "CR %route% jct.svg",
	Stark		= "CR %route% jct.svg",
	Summit		= "CR %route% jct.svg",
	Trumbull	= "CR %route% jct (yellow).svg",
	Tuscarawas	= "CR %route% jct.svg",
	Vinton		= "CR %route% jct (yellow).svg",
	Washington	= "CR %route% jct (green).svg",
	Williams	= "CR %route% jct (green).svg",
}

OH.CR.shield = {
	ifexists = true,
	default = countyShield,
	otherwise = ""
}
OH.CR.browse = "[[County roads in Ohio]]"
OH.CR.nbrowselinks = ""

OH.TR = {
	shield = {
		ifexists = true,
		default  = "%township% Township Route %route%, %county% County, Ohio.svg"
	},
	link = "",
	abbr = "TR&nbsp;%route%",
	browse = "",
	browselinks = ""
}

OH.KY = {alias = {module = "USA/KY", type = "KY"}}
OH["US-KY"] = {alias = {module = "USA/KY", type = "US"}}
OH.AA = {alias = {module = "USA/KY", type = "AA"}}
OH.WV = {alias = {module = "USA/WV", type = "WV"}}
OH.IN = {alias = {module = "USA/IN", type = "IN"}}

return OH