Module:VdbConfig

From Disney•Pixar CARS Wiki
Jump to navigation Jump to search
-- /**
--  * Major configuration variables for various fields and tables
--  * note- this is currently listed on "Vehicle Database" nav template for easy
--  * access during ongoing Lua conversion project. It is *not* yet a reliable
--  * nor fully functional index.
--
--  * @module
--  */
local p = {}

-- /** @param string varName // name of variable to retrieve */
function p.getConfig( varName )
    local configValues = {
        vdbPrefix = 'vdb', --possible table reorg
        vdbNullValue = 'ZZZ',
        vdbTbdValue = "<small>''TBD''</small>",
        vdbNaValue = "<center>—</center>",
        vdbImageNeededValue = "<small><i>Image needed</i></small>",
        vdbMainTableName = 'Releases',
        vdbMainTableJoinStr = 'Case_str',
        vdbCaseTableName = 'Case_Contents',
        vdbCaseTableJoinStr = 'Namestring',
--  vdbVehicleTableName = 'Vehicles',
--  vdbVehicleTableJoinStr = 'Vehicle',
        vdbSeriesKeyRatio = { 10, 20, 70 },
        vdbRowTypes = { 'Asst', 'Item', 'Vehicle' },
        vdbScales = { '155', 'MiniRacer', 'Other' }, --changes TBD
        vdbItemFormats = { 'Single', '2-pack', 'Multipack' },
        vdbRegionNames = { 'NA', 'INTL', 'RU', 'ES', 'DE' }, --order currently matters, see cardbacks in Module:Mattel item
        vdbMadeInCountries = { 'CH', 'TH', 'VN', 'MX' },
        vdbRelID = { 0, 1 },
        vdbChaseStatus = { 'Chase', 'Super Chase' },
        }
    return configValues[varName]
end

-- /** Full list of all DB table column declarations
-- [i] = ['Field_Name'] - also the cell CSS class.
------ @param string  (1) = Cargo field type
------ @param string  (2) = Column name for <th> output
------ @param boolean (3) = Whether the output column should be sortable.
--  */
function p.getColumnData()
    return {
[1]  = {['NumID']        = { 'Integer',          'Page Row Number',  true }   },
[2]  = {['RowID']        = { 'Integer',          'Unique Row ID',    true }   },
[3]  = {['Row_Type']     = { 'Integer',          'Page Row Type',    true }   },
[4]  = {['RelID']        = { 'Integer',          'Released',         true }   }, --"Rel"
[5]  = {['Vehicle']      = { 'Wikitext string',  'Character Name',   true }   },
[6]  = {['Model_Name']   = { 'Wikitext string',  'Model Name',       true }   },
[7]  = {['Toy_Number']   = { 'Wikitext string',  'Toy Number',       true }   },
[8]  = {['Asst_Number']  = { 'Wikitext string',  'Asst. Number',     true }   },
[9]  = {['Year']         = { 'String',           'Year',             true }   },
[10] = {['Region']       = { 'String',           'Region',           true }   },
[11] = {['Franchise']    = { 'String',           'Franchise',        true }   },
[12] = {['Ser_Number']   = { 'Integer',          'Ser. Number',      true }   },
[13] = {['Col_Number']   = { 'Integer',          'Col. Number',      true }   },
[14] = {['Series_Type']  = { 'String',           'Series Type',      true }   },
[15] = {['Material']     = { 'Wikitext string',  'Material',         true }   },
[16] = {['Series_Style'] = { 'Wikitext string',  'Series Style',     true }   },
[17] = {['Series']  = { 'Wikitext string',  'Series Name',      true }   },
[18] = {['Format']       = { 'String',           'Rel. Format',      true }   }, 
[19] = {['Segment']      = { 'Wikitext',         'Segment',          true }   },
[20] = {['Chase']        = { 'Wikitext string',  'Chase',            true }   },
[21] = {['Loose_Photo']  = { 'Wikitext string',  'Photo',           false }   },
[22] = {['Cast_Number']  = { 'Wikitext string',  'Cast Number',      true }   },
[23] = {['Country']      = { 'Wikitext string',  'Made In',          true }   },
[24] = {['Case_Number']     = { 'Wikitext string',  'Case Number',      true }   },
[25] = {['Notes']        = { 'Wikitext string',  'Notes',           false }   },
[26] = {['UPC']          = { 'Integer',          'UPC',              true }   },
[27] = {['Ages']         = { 'String',           'Ages',             true }   },
[28] = {['Exclusive']    = { 'Wikitext string',  'Exclusive',        true }   },
[29] = {['Scale']        = { 'Wikitext string',  'Scale',            true }   },
[30] = {['Toy_Sortkey']  = { 'Wikitext string',  'Bio',              true }   }, 
[31] = {['Case_MY']      = { 'Integer',          'Multi-Year',       true }   },
[32] = {['Search_Utils'] = { 'Wikitext string',  'Keywords',         true }   },
[33] = {['SIOC_Code']    = { 'Wikitext string',  'Case #',           true }   },
[34] = {['Bio']          = { 'Wikitext string',  'Bio',              true }   },
[35] = {['Phrases']      = { 'Wikitext string',  'Phrases',          true }   },
-- @todo from around here onwards hook in a way for users to edit
-- need to exclude from Cargo intake
--if {{mattel item}} arg handling is changing then another reason to define tmp.
--parameter names here rather than expect update in all places
[36] = {['Frequency']    = { 'Wikitext string',  'MHz',        true }   }, --Fq.
--service ref. auto from Toy_Number
-- Ref. / INTL Ref. / etc. undecided - regional handling
    }
end

-- /**
--  * @return array // key-only for easier lookup.
--  */
function p.getNumberlessColumnData()
	local columns_Numberless = {}
	local column_data = p.getColumnData()
	for c, _ in ipairs( column_data ) do
		local columnName, columnParams = next( column_data[c] )
	    columns_Numberless[ columnName ] = columnParams
	end
	return columns_Numberless
end

-- /**
--  * @return array // series type info.
--  */
function p.getCurrentTypeInfo()
    return {
        [1] = { ["1:55"] = { 'Mainline', '#FF0000' }   },
        -- "side series" #800080
        [2] = { ["2a"] = { 'Secondary format', '#808080' }   },
        [3] = { ["3a"] = { 'Collection', '#800080' }   },
        [4] = { ["4a"] = { 'Special series', '#2399f1' }   },
        [5] = { ["5a"] = { 'Exclusive', 'red' }   },
        [6] = { ["Premium"] = { 'Premium', '#4fc878' }   },
        [7] = { ["Other"] = { 'Other non-1:55', 'orange' }   },
--        [10] = { ["MiniRacer"] = { 'Mini Racers', '#FF0000' }   },        
    }	
end

return p