// Path: src/main/java/org/learning/by/example/reactive/microservices/model/GeographicCoordinates.java
// public final class GeographicCoordinates {
// 
//     public double getLatitude() {
//         return latitude;
//     }
// 
//     public double getLongitude() {
//         return longitude;
//     }
// 
//     private final double latitude;
//     private final double longitude;
// 
//     @JsonCreator
//     public GeographicCoordinates(@JsonProperty("latitude") double latitude, @JsonProperty("longitude") double longitude) {
//         this.latitude = latitude;
//         this.longitude = longitude;
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/model/LocationRequest.java
// public class LocationRequest {
// 
//     private final String address;
// 
//     @JsonCreator
//     public LocationRequest(@JsonProperty("address") final String address) {
//         this.address = address;
//     }
// 
//     public String getAddress() {
//         return address;
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/model/LocationResponse.java
// public class LocationResponse {
// 
//     private final GeographicCoordinates geographicCoordinates;
//     private final SunriseSunset sunriseSunset;
// 
//     @JsonCreator
//     public LocationResponse(@JsonProperty("geographicCoordinates") final GeographicCoordinates geographicCoordinates,
//                             @JsonProperty("sunriseSunset") final SunriseSunset sunriseSunset) {
//         this.geographicCoordinates = geographicCoordinates;
//         this.sunriseSunset = sunriseSunset;
//     }
// 
//     public GeographicCoordinates getGeographicCoordinates() {
//         return geographicCoordinates;
//     }
// 
//     public SunriseSunset getSunriseSunset() {
//         return sunriseSunset;
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/model/SunriseSunset.java
// public class SunriseSunset {
// 
//     public String getSunrise() {
//         return sunrise;
//     }
// 
//     public String getSunset() {
//         return sunset;
//     }
// 
//     private final String sunrise;
//     private final String sunset;
// 
//     @JsonCreator
//     public SunriseSunset(@JsonProperty("sunrise") final String sunrise, @JsonProperty("sunset") final String sunset) {
//         this.sunrise = sunrise;
//         this.sunset = sunset;
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/services/GeoLocationService.java
// public interface GeoLocationService {
// 
//     Mono<GeographicCoordinates> fromAddress(Mono<String> addressMono);
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/services/SunriseSunsetService.java
// public interface SunriseSunsetService {
// 
//     Mono<SunriseSunset> fromGeographicCoordinates(Mono<GeographicCoordinates> geographicCoordinatesMono);
// }


import org.learning.by.example.reactive.microservices.model.GeographicCoordinates;
import org.learning.by.example.reactive.microservices.model.LocationRequest;
import org.learning.by.example.reactive.microservices.model.LocationResponse;
import org.learning.by.example.reactive.microservices.model.SunriseSunset;
import org.learning.by.example.reactive.microservices.services.GeoLocationService;
import org.learning.by.example.reactive.microservices.services.SunriseSunsetService;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;
package org.learning.by.example.reactive.microservices.handlers;


public class ApiHandler {

  private static final String ADDRESS = "address";
  private static final String EMPTY_STRING = "";

  private final ErrorHandler errorHandler;

  private final GeoLocationService geoLocationService;
  private final SunriseSunsetService sunriseSunsetService;

// Path: src/main/java/org/learning/by/example/reactive/microservices/model/GeographicCoordinates.java
// public final class GeographicCoordinates {
// 
//     public double getLatitude() {
//         return latitude;
//     }
// 
//     public double getLongitude() {
//         return longitude;
//     }
// 
//     private final double latitude;
//     private final double longitude;
// 
//     @JsonCreator
//     public GeographicCoordinates(@JsonProperty("latitude") double latitude, @JsonProperty("longitude") double longitude) {
//         this.latitude = latitude;
//         this.longitude = longitude;
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/model/LocationRequest.java
// public class LocationRequest {
// 
//     private final String address;
// 
//     @JsonCreator
//     public LocationRequest(@JsonProperty("address") final String address) {
//         this.address = address;
//     }
// 
//     public String getAddress() {
//         return address;
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/model/LocationResponse.java
// public class LocationResponse {
// 
//     private final GeographicCoordinates geographicCoordinates;
//     private final SunriseSunset sunriseSunset;
// 
//     @JsonCreator
//     public LocationResponse(@JsonProperty("geographicCoordinates") final GeographicCoordinates geographicCoordinates,
//                             @JsonProperty("sunriseSunset") final SunriseSunset sunriseSunset) {
//         this.geographicCoordinates = geographicCoordinates;
//         this.sunriseSunset = sunriseSunset;
//     }
// 
//     public GeographicCoordinates getGeographicCoordinates() {
//         return geographicCoordinates;
//     }
// 
//     public SunriseSunset getSunriseSunset() {
//         return sunriseSunset;
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/model/SunriseSunset.java
// public class SunriseSunset {
// 
//     public String getSunrise() {
//         return sunrise;
//     }
// 
//     public String getSunset() {
//         return sunset;
//     }
// 
//     private final String sunrise;
//     private final String sunset;
// 
//     @JsonCreator
//     public SunriseSunset(@JsonProperty("sunrise") final String sunrise, @JsonProperty("sunset") final String sunset) {
//         this.sunrise = sunrise;
//         this.sunset = sunset;
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/services/GeoLocationService.java
// public interface GeoLocationService {
// 
//     Mono<GeographicCoordinates> fromAddress(Mono<String> addressMono);
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/services/SunriseSunsetService.java
// public interface SunriseSunsetService {
// 
//     Mono<SunriseSunset> fromGeographicCoordinates(Mono<GeographicCoordinates> geographicCoordinatesMono);
// }


// Path: src/main/java/org/learning/by/example/reactive/microservices/handlers/ApiHandler.java
import org.learning.by.example.reactive.microservices.model.GeographicCoordinates;
import org.learning.by.example.reactive.microservices.model.LocationRequest;
import org.learning.by.example.reactive.microservices.model.LocationResponse;
import org.learning.by.example.reactive.microservices.model.SunriseSunset;
import org.learning.by.example.reactive.microservices.services.GeoLocationService;
import org.learning.by.example.reactive.microservices.services.SunriseSunsetService;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

package org.learning.by.example.reactive.microservices.handlers;


public class ApiHandler {

  private static final String ADDRESS = "address";
  private static final String EMPTY_STRING = "";

  private final ErrorHandler errorHandler;

  private final GeoLocationService geoLocationService;
  private final SunriseSunsetService sunriseSunsetService;

  public ApiHandler(final GeoLocationService geoLocationService, final SunriseSunsetService sunriseSunsetService,