<cfcomponent
	output="false"
	hint="I define the application settings and event handlers.">

	<!--- Define the application settings. --->
	<cfset this.name = hash( getCurrentTemplatePath() ) />
	<cfset this.applicationTimeout = createTimeSpan( 0, 0, 10, 0 ) />

	<!---
		Turn on session management because we need a way to keep
		track of the user's authentication across page requests.
	--->
	<cfset this.sessionManagement = true />
	<cfset this.sessionTimeout = createTimeSpan( 0, 0, 5, 0 ) />


	<cffunction
		name="onApplicationStart"
		access="public"
		returntype="boolean"
		output="false"
		hint="I initialize the application.">

		<!---
			Set up the Twilio information for Telephony integration.
			We will need this information to initialize phone calls.
		--->
		<cfset application.twilio = {
			accountSID = "********************",
			authToken = "********************",
			phoneNumber = "********************"
			} />

		<!---
			Set up the Pusher information for realtime push
			notifications. We will need Pusher to let the
			authentication page know about the phone-based
			interactions.
		--->
		<cfset application.pusher = {
			appID = "********************",
			key = "********************",
			secret = "********************"
			} />

		<!--- Return true so the page will continue loading. --->
		<cfreturn true />
	</cffunction>


	<cffunction
		name="onSessionStart"
		access="public"
		returntype="void"
		output="false"
		hint="I initialize the session.">

		<!---
			This is the code the user will need to enter on the
			phone in order to prove phone number authentication.
		--->
		<cfset session.authenticationCode = "" />

		<!---
			THis is the user's authenticated status. They will
			not be able to acecss the secure portion of this
			site until they are authenticated via Twilio.
		--->
		<cfset session.isAuthenticated = false />

		<!--- This is the user's phone number. --->
		<cfset session.phoneNumber = "" />

		<!--- Return out. --->
		<cfreturn />
	</cffunction>

</cfcomponent>