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

-- Kansas
local KS = {}

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

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

KS.I.link = {
	["135"] = "Interstate 135",
	["435"] = "Interstate 435",
	["635"] = "Interstate 635 (Kansas–Missouri)",
	["670"] = "Interstate 670 (Kansas–Missouri)",
	default = {
		hook = "splitlen",
		split = 3,
		above = "Interstate %route% (Kansas)",
		below = "Interstate %route% in Kansas"
	}
}

for k, v in pairs(KS) do if k:find ("^I") then 
	v.link = KS.I.link
	end
end
KS["I-Alt"].banner = "Alt plate blue.svg"

KS.US.name = "U.S. Highway %route%"
KS.US.link = "U.S. Route %route% in Kansas"
KS.US.abbr = "US-%route%"

KS["US 1962"] = KS["US 1961"]
KS["US 1961"].shield = "US %route% Kansas 1962.svg"

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

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

KS["US-Hist"].shield = "" --"US %route% (KS historic).svg"
KS["US-Hist"].name = "Historic " .. KS.US.name
KS["US-Hist"].link = KS.US.link

KS.K = {
	base = "K-%route%",
	shield = "K-%route%.svg",
	name = "K-%route%",
	link = "K-%route% ([dab||%dab% |]Kansas highway)",
	abbr = "K-%route%",
	width = "expand"
}
KS.KS = KS.K

for _,type in ipairs({'K', 'KS'}) do
	for _,year in ipairs({"1926", "1948", "1962", "1968"}) do
		KS[type .. " " .. year] = {
			shield = format("K-%%route%% (%s).svg", year),
			name = KS.K.name,
			link = KS.K.link,
			abbr = KS.K.abbr,
			width = "square",
		}
	end
end
KS["K 1968"].shield = {
	hook = "splitlen",
	split = 3,
	above = "K-%route% (1968).svg",
	 below = KS.K.shield
}
KS["KS 1968"] = KS["K 1968"]

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

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

KS.KSTP = {
	shield = "Kansas Turnpike.svg",
	name = "Kansas Turnpike",
	link = "Kansas Turnpike",
	abbr = "Kansas Turnpike",
	bannersuffix = "blue",
	maint = "[[Kansas Turnpike Authority]]"
}
KS.KTA = KS.KSTP

KS.Scenic = {
	shield = "Kansas Scenic Byway.svg",
	name = "%route%",
	link = "",
	abbr = "%route%",
	bannersuffix = "blue",
	width = "wide",
	color = "hist"
}

KS.CR.maint = ""

return KS