// Copyright 2014 Apple Inc.  All Rights Reserved.
new ReverseTemplateList([new ReverseTemplate("usairways.com-international-reservation-en",function(e){return/^US AIRWAYS - CONFIRMATION CODE:/.test(e.subject)},function(e){if(/^US AIRWAYS - CONFIRMATION CODE:/.test(e.subject)){var r=Scanner.fromMessage(e);r.setLocale("en_US");var t,a,i,n,p,s,o,m,u,l,d,c,g,h,T,A,C,N,v=[],S={};if(i=r.getSpan().innerCapture(/CUSTOMER NAME :\s+(.*)\s/,1),not(i))return CONTINUE;for(u=r.getSpan().innerCapture(/[A-Z]{3} FARE.+($<priceCurrency>[A-Z]{3}) TTL\s+.+?($<totalPrice>[\d,.]+)\r?\n/),o=u?u.$totalPrice:null,m=u?u.$priceCurrency:null,S[""+i]={name:i,seats:{},seatingType:{},totalPrice:o,priceCurrency:m},t=r.getSpan().innerCapture(/CONFIRMATION NUMBER:\s+(\w+)\s/,1),l=r.getSpan().nextRegExp(/SEGMENT\s+TIME\s+DATE\s+FLIGHT\s+STATUS\s+/).collapseToEnd().withEnd(r.getSpan().nextRegExp(/REFUND DUE SUBJECT TO AUDIT/).getStart()),itineraryPattern=concatRegExp(/\*\d{1,}\.\s+LV ($<departureAirport>.*?) ($<departureCode>[A-Z]{3})\s+/,/($<departureTime>\d{3,}[A|P]M)\s+($<currentDate>\d{2}[A-Z]{3}).+($<airlineCode>[\w]{2}) ($<flightNumber>\d+).+\s+/,/AR\s+($<arrivalAirport>.*?) ($<arrivalCode>[A-Z]{3})\s+($<arrivalTime>\d{3,}[A|P]M)\s+/,/(?:OPERATED BY: ($<airlineName>.*)\s+)?/);l.innerCapture(itineraryPattern);)p=l.innerCapture(itineraryPattern),n=r.getDetachedSpan(""+p.$currentDate),h=p.$departureAirport,T=p.$departureCode,g=combineDateAndTime(n,p.$departureTime),C=p.$arrivalAirport,N=p.$arrivalCode,A=combineDateAndTime(n,p.$arrivalTime),c=p.$airlineCode,d=p.$airlineName,s=p.$flightNumber,ASSERT(i,c,s,T,g,N,A)&&v.push({airlineCode:c,flightNumber:s,departureCode:T,departureTime:g,departureAirport:h,arrivalCode:N,arrivalTime:A,arrivalAirport:C,passengers:S}),l=l.withStart(p[0].getEnd());for(var b=[],$=0;$<v.length;$++)for(var E=v[$],y=Object.keys(E.passengers),R=0;R<y.length;R++){var f=E.passengers[y[R]],I={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:E.airlineName,airlineCode:E.airlineCode,flightNumber:E.flightNumber,departureAirportFuzzy:E.departureAirport,departureAirportCode:E.departureCode,departureTime:E.departureTime,arrivalAirportFuzzy:E.arrivalAirport,arrivalAirportCode:E.arrivalCode,arrivalTime:E.arrivalTime},underName:{"@type":"http://schema.org/Person",name:f.name,email:f.email},checkinUrl:a,reservationId:E.reservationId,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:f.totalPrice,priceCurrency:f.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:f.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:f.seats[E.flightNumber],seatingType:f.seatingType[E.flightNumber]}}};valid(f.membershipNumber,f.programName)&&(I.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:f.membershipNumber,programName:f.programName}),b.push(I)}if(b.length)return b}},"0/1/2/3/4/5/240/617/621","SG663309b6")]);