<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<spring>
	
		<context>
			<resource uri="config://spring/objects" />
		</context>
	
		<objects xmlns="http://www.springframework.net" xmlns:v="http://www.springframework.net/validation">

			<object type="TripForm.aspx" parent="standardPage">
				<property name="BookingAgent" ref="bookingAgent" />
				<property name="AirportDao" ref="airportDao" />
				<property name="TripValidator" ref="tripValidator" />
				<property name="Results">
					<dictionary>
						<entry key="displaySuggestedFlights" value="redirect:SuggestedFlights.aspx" />
					</dictionary>
				</property>
			</object>
	
			<object type="SuggestedFlights.aspx" parent="standardPage">
				<property name="BookingAgent" ref="bookingAgent" />
				<property name="Results">
					<dictionary>
						<entry key="reservationConfirmed" value="redirect:ReservationConfirmationPage.aspx" />
					</dictionary>
				</property>
			</object>
	
			<object type="ReservationConfirmationPage.aspx" parent="standardPage" />

			<v:group id="tripValidator">

				<v:required id="departureAirportValidator" test="StartingFrom.AirportCode">
				  <v:message id="error.departureAirport.required" providers="departureAirportErrors, validationSummary"/>
				</v:required>

			  <v:group id="destinationAirportValidator">
				  <v:required test="ReturningFrom.AirportCode">
				    <v:message id="error.destinationAirport.required" providers="destinationAirportErrors, validationSummary"/>
				  </v:required>
				  <v:condition test="ReturningFrom.AirportCode != StartingFrom.AirportCode" when="ReturningFrom.AirportCode != ''">
				    <v:message id="error.destinationAirport.sameAsDeparture" providers="destinationAirportErrors, validationSummary"/>
				  </v:condition>
			  </v:group>

				<v:group id="departureDateValidator">
					<v:required test="StartingFrom.Date">
				    <v:message id="error.departureDate.required" providers="departureDateErrors, validationSummary"/>
				  </v:required>
					<v:condition test="StartingFrom.Date >= DateTime.Today" when="StartingFrom.Date != DateTime.MinValue">
				    <v:message id="error.departureDate.inThePast" providers="departureDateErrors, validationSummary"/>
					</v:condition>
				</v:group>
			
				<v:group id="returnDateValidator" when="Mode == 'RoundTrip'">
					<v:required test="ReturningFrom.Date">
				    <v:message id="error.returnDate.required" providers="returnDateErrors, validationSummary"/>
				  </v:required>
					<v:condition test="ReturningFrom.Date >= StartingFrom.Date" when="ReturningFrom.Date != DateTime.MinValue">
				    <v:message id="error.returnDate.beforeDeparture" providers="returnDateErrors, validationSummary"/>
				  </v:condition>
				</v:group>
			
			</v:group>

		</objects>
	</spring>
</configuration>
