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

-- Kentucky
local KY = {}

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

local suffix = " ([dab||%dab%, |]Kentucky)"
 
KY.I.link = "Interstate %route% (Kentucky)"

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

KY.BL.link = "Interstate %route% Business ([dab||%dab%, |]Kentucky)"
KY["I-Bus"]=KY.BL

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

KY.US.link = "U.S. Route %route% [dab||(%dab%, Kentucky)|in Kentucky]"

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

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

KY.KY = {	
	shield = "Elongated circle %route%.svg",
	base = "Kentucky Route %route%",
	name = "Kentucky Route %route%",
	link = "Kentucky Route %route% [dab||(%dab%)|]",
	abbr = "KY&nbsp;%route%",
	width = "expand"
}

KY["KY 1966"] = {
	shield = {hook = "split",
		split = 100,
		below = "Elongated circle %route%.svg", 
		above = "Circle sign %route%.svg"
	},
	name = KY.KY.name,
	link = KY.KY.link,
	abbr = KY.KY.abbr
}

for _,auxType in ipairs({"Bus", "Byp", "Conn", "Spur", "Truck"}) do
	local spec = KY[" aux "][auxType]
	KY["KY-" .. auxType] = {
		shield = KY.KY.shield,
		name = KY.KY.base .. " " .. spec.name,
		link = KY.KY.base .. " " .. spec.name .. KY[" dab "],
		abbr = KY.KY.abbr .. " " .. spec.abbrsuffix,
		banner = spec.bannerprefix .. " plate.svg",
		aux = spec.aux,
		width = "expand",
	}
end

KY.AA = {
	shield = {
		["9"] = "AA Highway KY 9.svg",
		["10"] = "AA Highway KY 10.svg",
		default = "AA Highway Shield.svg"
		},
	name = {
		["9"] = "AA&nbsp;Highway&nbsp;KY&nbsp;10",
		["10"] = "AA&nbsp;Highway&nbsp;KY&nbsp;10",
		default = "AA&nbsp;Highway"
		},
	link = {
		["9"] = KY.KY.link,
		["10"] = KY.KY.link,
		default = "AA Highway"
		},
	abbr = {
		["9"] = "AA&nbsp;Hwy (KY&nbsp;9)",
		["10"] = "AA&nbsp;Hwy (KY&nbsp;10)",
		default ="AA&nbsp;Hwy"
		},
	width = "expand",
	bannersuffix = {
		default = ""
		}
}

KY.Trace = {
	shield = "", -- needs a shield image: http://www.kentuckyroads.com/images/lbl-03july/
	name = "The Trace",
	link = "The Trace (Land Between the Lakes)",
	abbr = "The Trace",
	color = "hist"
}

KY.Parkway = {
	shield = {
		["Kentucky Turnpike"] = "Kentucky Turnpike shield.png",
		default = "%route% Parkway.svg"
	},
	shieldmain = {
		["Kentucky Turnpike"] = "Kentucky Turnpike shield.png",
		default = "%route% Parkway fair use.svg",
	},
	name = {
		["Kentucky Turnpike"] = "Kentucky Turnpike",
		default = "%route% Parkway"
	},
	link = {
		["Kentucky Turnpike"] = "Kentucky Turnpike",
		default = "%route% Parkway"
	},
	abbr = {
		["Kentucky Turnpike"] = "Kentucky Turnpike",
		default = "%route% Parkway"
	},
	width = "wide",
	bannersuffix = {
		["Kentucky Turnpike"] = "",
		default = "blue"
	}
}

-- add new types above this line if you want it to have the state highway browse and maint
for k, v in pairs(KY) do if k:find ("^%a") then
	v.maint = "[[Kentucky Transportation Cabinet|KYTC]]"
	v.browse = "[[Numbered highways in Kentucky|Highways in Kentucky]]"
	v.browselinks = {
		[1] = "[[List of Interstate Highways in Kentucky|Interstate]]",
		[2] = "[[List of U.S. Highways in Kentucky|US]]",
		[3] = "[[List of state highways in Kentucky|State]]",
		[4] = "[[List of parkways and named highways in Kentucky|Parkways]]"
	}
	end
end

KY.CR.maint = ""   

KY["I-IN"] = {alias = {module = "USA/IN", type = "I"}}
KY["US-OH"] = {alias = {module = "USA/OH", type = "US"}}
KY.TN = {alias = {module = "USA/TN", type = "KY"}}
KY.Sec = {alias = {module = "USA/TN", type = "Sec"}}

return KY