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

-- Utah
local UT = {}

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

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

UT.I.link = {
	hook = "splitlen",
	split = 3,
	above = "Interstate %route% (Utah)",
	below = "Interstate %route% in Utah"
}
UT.I.law = "<span class='plainlinks'>[http://le.utah.gov/xcode/Title72/Chapter4/72-4-S%section%.html Utah Code §72-4-%section%]</span>"

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

UT.BL.link = "Interstate %route% Business" .. suffix
UT.BL.law = UT.I.law

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

UT.US.link = "U.S. Route %route% in Utah"
UT.US.law = UT.I.law

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

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

UT.UT = {
	shield = {
		default = "Utah %route%.svg",
        ["281-320"] = ""
	},
	name = "State Route %route%",
	link = {
		default = "Utah State Route %route% [dab||(%dab%)|]",
		["281-320"] = "List of state highways serving Utah state parks and institutions"},
	abbr = {
		default = "SR-%route%",
		["281-320"] = "SR-281 to SR-320"
	},
	law = {
		default = UT.I.law,
		["301"] = "<span class='plainlinks'>[http://le.utah.gov/xcode/Title72/Chapter3/72-3-S301.html Utah Code §72-3-301]</span>"
	}
}
UT.SR = UT.UT

for _,type in ipairs({"SR", "UT"}) do
	for _,year in ipairs({"1926", "1954", "1962"}) do
		UT[type .. " " .. year] = {
			shield = format("Utah %%route%% (%s).svg", year),
			name = UT.UT.name,
			link = UT.UT.link,
			abbr = UT.UT.abbr,
			width = "square"
		}
	end
end
UT["UT 1962"].shield = {
	default = "Utah SR %route%.svg",
    ["281-320"] = ""
	}
UT["UT 1962"].link = UT.UT.link
UT["UT 1962"].abbr = UT.UT.abbr
UT["SR 1962"] = UT["UT 1962"]
UT["UT 1966"] = UT["UT 1962"]
UT["SR 1966"] = UT["UT 1962"]

UT.BLSR = {
	shieldmain = {
		["19"] = {"Business Loop 70.svg", "Utah %route%.svg"},
		["120"] = {"Business Loop 70.svg", "Utah %route%.svg"},
		default = {"Business Loop 15.svg", "Utah %route%.svg"},
},
	name = UT.UT.name,
	link = "",
	abbr = UT.UT.abbr,
	nbrowse = UT.I.nbrowse,
	nbrowselinks = UT.I.nbrowselinks
}

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

UT.BIA = {
	shield = "Indian Route&nbsp;%route%.svg",
	name = "BIA Route&nbsp;%route%",
	link = "BIA Route&nbsp;%route%",
	abbr = "BIA Route&nbsp;%route%"
}

UT.AZ = {alias = {module = "USA/AZ", type = "AZ"}}
UT.CO = {alias = {module = "USA/CO", type = "SH"}}
UT.ID = {alias = {module = "USA/ID", type = "SH"}}
UT.NM = {alias = {module = "USA/NM", type = "NM"}}
UT.NV = {alias = {module = "USA/NV", type = "SR"}}
UT.WY = {alias = {module = "USA/WY", type = "WY"}}
          
return UT