-- << FUNCTIONS >>

function module:Notice(noticeType, title, description, args)
	if not main.pdata or not main.pdata.SetupData then
		repeat wait(0.1) until (main.pdata and main.pdata.SetupData)
	end
	if main.settings.DisableAllNotices ~= true then
		spawn(function()
			local notice = template:Clone()
			notice.Visible = true
			notice.Title.Text = title
			notice.Desc.Text = description
			notice.NoticeType.Value = noticeType
			--[[spawn(function()
				wait()
				if notice.Desc.TextBounds.Y > 35 then
					notice.Desc.Position = UDim2.new(0.05, 0, 0.37, 0)
				end
			end)--]]
			if type(args) == "table" then
				local de = true
				local function checkDe()
					if de then
						de = false
						return true
					end
				end
				local clickAction = args[1]
				if clickAction == "ShowSpecificPage" then
					notice.Countdown.Value = 20
					notice.TextButton.MouseButton1Down:Connect(function()
						if not checkDe() then return end
						main:GetModule("GUIs"):ShowSpecificPage(args[2], args[3])
						endNotice(notice)
					end)
				elseif clickAction == "Teleport" then
					notice.Countdown.Value = 25
					notice.TextButton.MouseButton1Down:Connect(function()
						if not checkDe() then return end
						main.teleportService:Teleport(args[2])
						notice.Desc.Text = "Teleporting..."
					end)
				elseif clickAction == "PM" then
					notice.Countdown.Value = 999
					notice.TextButton.MouseButton1Down:Connect(function()
						if not checkDe() then return end
						main:GetModule("cf"):CreateNewCommandMenu("privateMessage", {args[2], args[3]}, 4)
						endNotice(notice)
					end)
				end
			end
			notice.CloseX.MouseButton1Down:Connect(function()
				endNotice(notice)
			end)
			table.insert(noticeQueue, notice)
			Queue()
		end)
	end
end

