# frozen_string_literal: true

class WelcomeMessage
	def initialize(customer, tel)
		@customer = customer
		@tel = tel
	end

	def welcome
		EM.promise_timer(10).then do
			# Wait for cheogram to get the finish and set up the route
			@customer.stanza_to(message)
		end
	end

	def message
		m = Blather::Stanza::Message.new
		m.from = CONFIG[:notify_from]
		m.body =
			"Welcome to JMP!  Your JMP number is #{@tel}. This is an automated " \
			"message, but anything you send here will go direct to real humans " \
			"who will be happy to help you.  Such support requests will get a " \
			"reply within 8 business hours.\n\n" \
			"FAQ: https://jmp.chat/faq\n\n" \
			"Account Settings: xmpp:cheogram.com?command"
		m
	end
end
