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

-- Georgia
local GA = {}

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

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

GA.I.link = {	hook = "split",
                split = 100,
				above = "Interstate %route% (Georgia)",
                below = "Interstate %route% in Georgia"}

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

GA.BL.link = "Interstate %route% Business " .. suffix

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

GA.US.name = "U.S. Highway %route%"
GA.US.link = "U.S. Route %route% in Georgia"

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

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

for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Spur"}) do
	local spec = GA[" aux "][auxType]
		for k, v in pairs(GA) do if k:find (auxType) then if k:find ("^US") then
			v.shield = "US %route% " .. spec.name .. ".svg"
			v.name = GA.US.name .. " " .. spec.name
			v.link = GA.US.base .. " " .. spec.name .. suffix
			v.banner = ""
			end
		end
	end
end

for _,year in ipairs({'1948', '1961'}) do
	for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Opt", "Scenic", "Spur", "Temp", "Truck"}) do
		local type = "US " .. year
		local spec = GA[" aux "][auxType]
		GA[type .. "-" .. auxType] = {
			shield = GA[type].shield,
			shieldmain = GA[type].shieldmain,
			name = GA[type].name .. " " .. spec.name,
			link = GA[type].base .. " " .. spec.name .. suffix,
			abbr = GA[type].abbr .. " " .. spec.abbrsuffix,
			banner = spec.bannerprefix .. " plate " .. year .. ".svg",
			aux = spec.aux,
			width = "square"
		}
	end
end
                
GA.SR = {
	base = "Georgia State Route %route%",
	shield = {
		hook = "split",
		split = 1000,
		above = "",
		below = "Georgia %route%.svg"
	},
	shieldmain = {
		hook = "split",
		split = 1000,
		above = "",
		below = "Georgia %route%.svg"
	},
	name = "State Route %route%",
	link = "Georgia State Route %route% [dab||(%dab%)|]",
	abbr = "SR&nbsp;%route%",
	width = "expand",
	bannersuffix = {
		arg = "route",
		["515"] = "blue",
		["520"] = "green",
	}
}
GA.GA = GA.SR

for _,type in ipairs({'SR', 'GA'}) do
	for _,year in ipairs({"1920", "1926", "1948", "1960"}) do
		GA[type .. " " .. year] = {
			shield = format("Georgia %%route%% (%s).svg", year),
			base = GA.SR.base,
			name = GA.SR.name,
			link = GA.SR.link,
			abbr = GA.SR.abbr,
			width = "square",
		}
	end
end

for _,type in ipairs({'SR', 'GA'}) do
	for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Loop", "Spur"}) do
		local spec = GA[" aux "][auxType]
		GA[type .. "-" .. auxType] = {
			shield = "Georgia %route% " .. spec.name .. ".svg",
			name = GA.SR.name .. " " .. spec.name,
			link = GA.SR.base .. " " .. spec.name .. suffix2,
			abbr = GA.SR.abbr .. " " .. spec.abbrsuffix,
			banner = "",
			aux = spec.aux,
			bannersuffix = GA.SR.bannersuffix,
			width = GA.SR.width
		}
	end
end

for _,type in ipairs({'SR', 'GA'}) do
	for _,year in ipairs({"1926", "1948"}) do
		for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Loop", "Spur"}) do
			local spec = GA[" aux "][auxType]
			local newType = type .. " " .. year
			GA[newType .. "-" .. auxType] = {
				shield = GA["SR " .. year].shield,
				name = GA.SR.name .. " " .. spec.name,
				link = GA.SR.base .. " " .. spec.name .. suffix2,
				abbr = GA.SR.abbr .. " " .. spec.abbrsuffix,
				banner = spec.bannerprefix .. " plate " .. year .. ".svg",
				aux = spec.aux,
				width = GA.SR.width
			}
		end
	end
end

for _,type in ipairs({'SR 1960', 'GA 1960'}) do
	for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Loop", "Spur"}) do
		local spec = GA[" aux "][auxType]
		GA[type .. "-" .. auxType] = {
			shield = "Georgia %route% " .. spec.name .. " (1960).svg",
			name = GA.SR.name .. " " .. spec.name,
			link = GA.SR.base .. " " .. spec.name .. suffix2,
			abbr = GA.SR.abbr .. " " .. spec.abbrsuffix,
			banner = "",
			aux = spec.aux,
			width = GA.SR.width
		}
	end
end

GA["SR-Truck"] = {
	shield = GA.SR.shield,
	name = GA.SR.name .. " Truck",
	link = GA.SR.base .. " Truck" .. suffix2,
	abbr = GA.SR.abbr .. " Truck",
	banner = "Truck plate.svg",
	width = GA.SR.width
}

GA["GA-Truck"] = GA["SR-Truck"]

GA.Byway = {
	shield = "Georgia Scenic Byway.svg",
	name = "%route%",
	link = "List of Georgia Scenic Byways",
	abbr = "%route%",
}

GA.SBR = {
	shield = "US Bike %route% (M1-8).svg",
	name = "State Bicycle Route %route%",
	link = "Georgia State Bicycle Route %route%",
	abbr = "SBR&nbsp;%route%",
	orientation = "upright"
}

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

return GA