// Path: acmeair-services/src/main/java/com/acmeair/service/FlightService.java
// public abstract class FlightService {
//     protected Logger logger = Logger.getLogger(FlightService.class.getName());
// 
//     //TODO:need to find a way to invalidate these maps
//     protected static ConcurrentHashMap<String, FlightSegment> originAndDestPortToSegmentCache =
//         new ConcurrentHashMap<String, FlightSegment>();
// 
//     protected static ConcurrentHashMap<String, List<Flight>> flightSegmentAndDataToFlightCache =
//         new ConcurrentHashMap<String, List<Flight>>();
// 
//     protected static ConcurrentHashMap<String, Flight> flightPKtoFlightCache =
//         new ConcurrentHashMap<String, Flight>();
// 
//     public Flight getFlightByFlightId(String flightId, String flightSegment) {
//         try {
//             Flight flight = flightPKtoFlightCache.get(flightId);
//             if (flight == null) {
//                 flight = getFlight(flightId, flightSegment);
//                 if (flightId != null && flight != null) {
//                     flightPKtoFlightCache.putIfAbsent(flightId, flight);
//                 }
//             }
//             return flight;
//         } catch (Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     protected abstract Flight getFlight(String flightId, String flightSegment);
// 
//     public List<Flight> getFlightByAirportsAndDepartureDate(String fromAirport, String toAirport, Date deptDate) {
//         if (logger.isLoggable(Level.FINE))
//             logger.fine("Search for flights from " + fromAirport + " to " + toAirport + " on " + deptDate.toString());
// 
//         String originPortAndDestPortQueryString = fromAirport + toAirport;
//         FlightSegment segment = originAndDestPortToSegmentCache.get(originPortAndDestPortQueryString);
// 
//         if (segment == null) {
//             segment = getFlightSegment(fromAirport, toAirport);
//             originAndDestPortToSegmentCache.putIfAbsent(originPortAndDestPortQueryString, segment);
//         }
//         // cache flights that not available (checks against sentinel value above indirectly)
//         if (segment.getFlightName() == null) {
//             return new ArrayList<Flight>();
//         }
// 
//         String segId = segment.getFlightName();
//         String flightSegmentIdAndScheduledDepartureTimeQueryString = segId + deptDate.toString();
//         List<Flight> flights =
//             flightSegmentAndDataToFlightCache.get(flightSegmentIdAndScheduledDepartureTimeQueryString);
// 
//         if (flights == null) {
//             flights = getFlightBySegment(segment, deptDate);
//             flightSegmentAndDataToFlightCache.putIfAbsent(flightSegmentIdAndScheduledDepartureTimeQueryString,
//                     flights);
//         }
//         if (logger.isLoggable(Level.FINEST))
//             logger.finest("Returning " + flights);
//         return flights;
// 
//     }
//     public List<Flight> getFlightByAirportsAndDate(String fromAirport, String toAirport, Date deptDate) {
//         if (logger.isLoggable(Level.FINE))
//             logger.fine("Search for flights from " + fromAirport + " to " + toAirport + " on " + deptDate.toString());
// 
//         List<Flight> flights = getFlightByAirports(fromAirport, toAirport);
//         List<Flight> results = new ArrayList<>();
//         for (Flight flight : flights) {
//             if (inOneDay(flight.getScheduledDepartureTime(), deptDate)) {
//                 results.add(flight);
//             }
//         }
// 
//         return results;
//     }
// 
//     @SuppressWarnings("deprecation")
//     protected boolean inOneDay(Date date1, Date date2) {
//         return (date1.getYear() == date2.getYear()) && (date1.getMonth() == date2.getMonth())
//                 && (date1.getDate() == date2.getDate());
//     }
//     
//     // NOTE:  This is not cached
//     public List<Flight> getFlightByAirports(String fromAirport, String toAirport) {
//         FlightSegment segment = getFlightSegment(fromAirport, toAirport);
//         if (segment == null) {
//             return new ArrayList<Flight>();
//         }
//         return getFlightBySegment(segment, null);
//     }
// 
//     protected abstract FlightSegment getFlightSegment(String fromAirport, String toAirport);
// 
//     protected abstract List<Flight> getFlightBySegment(FlightSegment segment, Date deptDate);
// 
//     public abstract void storeAirportMapping(AirportCodeMapping mapping);
// 
//     public abstract AirportCodeMapping createAirportCodeMapping(String airportCode, String airportName);
// 
//     public abstract Flight createNewFlight(String flightSegmentId,
//             Date scheduledDepartureTime, Date scheduledArrivalTime,
//             BigDecimal firstClassBaseCost, BigDecimal economyClassBaseCost,
//             int numFirstClassSeats, int numEconomyClassSeats,
//             String airplaneTypeId);
// 
//     public abstract void storeFlightSegment(FlightSegment flightSeg);
// 
//     public abstract void storeFlightSegment(String flightName, String origPort, String destPort, int miles);
// 
//     public abstract Long countFlightSegments();
// 
//     public abstract Long countFlights();
// 
//     public abstract Long countAirports();
// 
// }


import java.util.ArrayList;
import java.util.logging.Logger;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.acmeair.service.BookingService;
import com.acmeair.service.FlightService;
import io.servicecomb.provider.rest.common.RestSchema;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
package com.acmeair.config;





@RestSchema(schemaId = "config")
@Path("/info/config")
@Api(value = "Booking Service Configuration Information Service", produces = MediaType.APPLICATION_JSON)
public class AcmeAirConfiguration {

    Logger logger = Logger.getLogger(AcmeAirConfiguration.class.getName());

    @Autowired
    private BookingService bs;

    @Autowired
// Path: acmeair-services/src/main/java/com/acmeair/service/FlightService.java
// public abstract class FlightService {
//     protected Logger logger = Logger.getLogger(FlightService.class.getName());
// 
//     //TODO:need to find a way to invalidate these maps
//     protected static ConcurrentHashMap<String, FlightSegment> originAndDestPortToSegmentCache =
//         new ConcurrentHashMap<String, FlightSegment>();
// 
//     protected static ConcurrentHashMap<String, List<Flight>> flightSegmentAndDataToFlightCache =
//         new ConcurrentHashMap<String, List<Flight>>();
// 
//     protected static ConcurrentHashMap<String, Flight> flightPKtoFlightCache =
//         new ConcurrentHashMap<String, Flight>();
// 
//     public Flight getFlightByFlightId(String flightId, String flightSegment) {
//         try {
//             Flight flight = flightPKtoFlightCache.get(flightId);
//             if (flight == null) {
//                 flight = getFlight(flightId, flightSegment);
//                 if (flightId != null && flight != null) {
//                     flightPKtoFlightCache.putIfAbsent(flightId, flight);
//                 }
//             }
//             return flight;
//         } catch (Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     protected abstract Flight getFlight(String flightId, String flightSegment);
// 
//     public List<Flight> getFlightByAirportsAndDepartureDate(String fromAirport, String toAirport, Date deptDate) {
//         if (logger.isLoggable(Level.FINE))
//             logger.fine("Search for flights from " + fromAirport + " to " + toAirport + " on " + deptDate.toString());
// 
//         String originPortAndDestPortQueryString = fromAirport + toAirport;
//         FlightSegment segment = originAndDestPortToSegmentCache.get(originPortAndDestPortQueryString);
// 
//         if (segment == null) {
//             segment = getFlightSegment(fromAirport, toAirport);
//             originAndDestPortToSegmentCache.putIfAbsent(originPortAndDestPortQueryString, segment);
//         }
//         // cache flights that not available (checks against sentinel value above indirectly)
//         if (segment.getFlightName() == null) {
//             return new ArrayList<Flight>();
//         }
// 
//         String segId = segment.getFlightName();
//         String flightSegmentIdAndScheduledDepartureTimeQueryString = segId + deptDate.toString();
//         List<Flight> flights =
//             flightSegmentAndDataToFlightCache.get(flightSegmentIdAndScheduledDepartureTimeQueryString);
// 
//         if (flights == null) {
//             flights = getFlightBySegment(segment, deptDate);
//             flightSegmentAndDataToFlightCache.putIfAbsent(flightSegmentIdAndScheduledDepartureTimeQueryString,
//                     flights);
//         }
//         if (logger.isLoggable(Level.FINEST))
//             logger.finest("Returning " + flights);
//         return flights;
// 
//     }
//     public List<Flight> getFlightByAirportsAndDate(String fromAirport, String toAirport, Date deptDate) {
//         if (logger.isLoggable(Level.FINE))
//             logger.fine("Search for flights from " + fromAirport + " to " + toAirport + " on " + deptDate.toString());
// 
//         List<Flight> flights = getFlightByAirports(fromAirport, toAirport);
//         List<Flight> results = new ArrayList<>();
//         for (Flight flight : flights) {
//             if (inOneDay(flight.getScheduledDepartureTime(), deptDate)) {
//                 results.add(flight);
//             }
//         }
// 
//         return results;
//     }
// 
//     @SuppressWarnings("deprecation")
//     protected boolean inOneDay(Date date1, Date date2) {
//         return (date1.getYear() == date2.getYear()) && (date1.getMonth() == date2.getMonth())
//                 && (date1.getDate() == date2.getDate());
//     }
//     
//     // NOTE:  This is not cached
//     public List<Flight> getFlightByAirports(String fromAirport, String toAirport) {
//         FlightSegment segment = getFlightSegment(fromAirport, toAirport);
//         if (segment == null) {
//             return new ArrayList<Flight>();
//         }
//         return getFlightBySegment(segment, null);
//     }
// 
//     protected abstract FlightSegment getFlightSegment(String fromAirport, String toAirport);
// 
//     protected abstract List<Flight> getFlightBySegment(FlightSegment segment, Date deptDate);
// 
//     public abstract void storeAirportMapping(AirportCodeMapping mapping);
// 
//     public abstract AirportCodeMapping createAirportCodeMapping(String airportCode, String airportName);
// 
//     public abstract Flight createNewFlight(String flightSegmentId,
//             Date scheduledDepartureTime, Date scheduledArrivalTime,
//             BigDecimal firstClassBaseCost, BigDecimal economyClassBaseCost,
//             int numFirstClassSeats, int numEconomyClassSeats,
//             String airplaneTypeId);
// 
//     public abstract void storeFlightSegment(FlightSegment flightSeg);
// 
//     public abstract void storeFlightSegment(String flightName, String origPort, String destPort, int miles);
// 
//     public abstract Long countFlightSegments();
// 
//     public abstract Long countFlights();
// 
//     public abstract Long countAirports();
// 
// }


// Path: acmeair-booking-service/src/main/java/com/acmeair/config/AcmeAirConfiguration.java
import java.util.ArrayList;
import java.util.logging.Logger;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.acmeair.service.BookingService;
import com.acmeair.service.FlightService;
import io.servicecomb.provider.rest.common.RestSchema;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;

package com.acmeair.config;





@RestSchema(schemaId = "config")
@Path("/info/config")
@Api(value = "Booking Service Configuration Information Service", produces = MediaType.APPLICATION_JSON)
public class AcmeAirConfiguration {

    Logger logger = Logger.getLogger(AcmeAirConfiguration.class.getName());

    @Autowired
    private BookingService bs;

    @Autowired
    private FlightService flightService;