# WSP.UCC-4.Lists.ps1

function CreateLists 
{
    try
	{
		# NOTE: Subsites are deprecated - UCC sites deploy to site collection root only
		Info "Lists..."
		$lists = @("Holidays", "Agents", "Version", "Businesshours", "CallClassifications", "CallSummary", "Endpoints",
					"IDRQuestions", "IVRQuestions", "OutboundDialerCalls", "Playlists", "PromptsConfig", "QualityMonitorConfig",
					"ReasonCodes", "Routing", "Settings", "settingsList", "SettingValues", "Skills", "SkillsPerAgent", "Supervisors",
					"VoicemailAgents", "PluginAttributes", "PluginFlowSettings", "PluginSettings", "CannedResponses", 
					"EncryptedTokens")
		foreach ($element in $lists) 
		{
			if ($element -ne "Version") 
			{
				AddPnPList $element -RemoveDefaultView | Out-Null
			}
			elseif ($element -eq "SettingValues")
			{
				AddPnPList $element -RemoveDefaultView -Hidden | Out-Null
			}
			elseif ($element -eq "Version")
			{
				AddPnPList $element -Hidden | Out-Null
			}
		}

		# Libraries
		$libraries = @("AudioFiles", "Recordings", "Voicemails")
		foreach ($library in $libraries) 
		{
			AddPnPList $library -DocumentLibrary | Out-Null
		}
	}
	catch 
	{
        Error "Exception Message: $($_.Exception.Message)"
		UpdateStatus $siteItem["ID"] "Error creating Lists"
		exit
    }
}
