// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/model/BrokerApiVersion.java
// @Getter
// @ToString
// @EqualsAndHashCode
// public class BrokerApiVersion {
// 
// 	public final static String DEFAULT_API_VERSION_HEADER = "X-Broker-Api-Version";
// 	public final static String API_VERSION_ANY = "*";
// 	public final static String API_VERSION_CURRENT = "2.8";
// 
// 	/**
// 	 * The name of the HTTP header field expected to contain the API version of the service broker client.
// 	 */
// 	private final String brokerApiVersionHeader;
// 
// 	/**
// 	 * The version of the broker API supported by the broker. A value of <code>null</code> or
// 	 * <code>API_VERSION_ANY</code> will disable API version validation.
// 	 */
// 	private final String apiVersion;
// 
// 	public BrokerApiVersion(String brokerApiVersionHeader, String apiVersion) {
// 		this.brokerApiVersionHeader = brokerApiVersionHeader;
// 		this.apiVersion = apiVersion;
// 	}
// 
// 	public BrokerApiVersion(String apiVersion) {
// 		this(DEFAULT_API_VERSION_HEADER, apiVersion);
// 	}
// 
// 	public BrokerApiVersion() {
// 		this(DEFAULT_API_VERSION_HEADER, API_VERSION_ANY);
// 	}
// }
// 
// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/model/Catalog.java
// @Getter
// @ToString
// @EqualsAndHashCode
// @JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE)
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class Catalog {
// 
// 	/**
// 	 * A list of service offerings provided by the service broker.
// 	 */
// 	@NotEmpty
// 	@JsonSerialize(nullsUsing = EmptyListSerializer.class)
// 	@JsonProperty("services")
// 	private final List<ServiceDefinition> serviceDefinitions;
// 
// 	public Catalog() {
// 		this.serviceDefinitions = null;
// 	}
// 
// 	public Catalog(List<ServiceDefinition> serviceDefinitions) {
// 		this.serviceDefinitions = serviceDefinitions;
// 	}
// }
// 
// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/service/BeanCatalogService.java
// public class BeanCatalogService implements CatalogService {
// 
// 	private Catalog catalog;
// 	private Map<String,ServiceDefinition> serviceDefs = new HashMap<String,ServiceDefinition>();
// 	
// 	@Autowired
// 	public BeanCatalogService(Catalog catalog) {
// 		this.catalog = catalog;
// 		initializeMap();
// 	}
// 	
// 	private void initializeMap() {
// 		for (ServiceDefinition def: catalog.getServiceDefinitions()) {
// 			serviceDefs.put(def.getId(), def);
// 		}
// 	}
// 	
// 	@Override
// 	public Catalog getCatalog() {
// 		return catalog;
// 	}
// 
// 	@Override
// 	public ServiceDefinition getServiceDefinition(String serviceId) {
// 		return serviceDefs.get(serviceId);
// 	}
// 
// }
// 
// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/service/CatalogService.java
// public interface CatalogService {
// 
// 	/**
// 	 * Return the catalog of services provided by the service broker.
// 	 *
// 	 * @return the catalog of services
// 	 */
// 	Catalog getCatalog();
// 
// 	/**
// 	 * Get a service definition from the catalog by ID.
// 	 *
// 	 * @param serviceId  The ID of the service definition in the catalog
// 	 * @return the service definition, or null if it doesn't exist
// 	 */
// 	ServiceDefinition getServiceDefinition(String serviceId);
// 	
// }
// 
// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/model/BrokerApiVersion.java
// public final static String API_VERSION_CURRENT = "2.8";


import org.springframework.cloud.servicebroker.model.BrokerApiVersion;
import org.springframework.cloud.servicebroker.model.Catalog;
import org.springframework.cloud.servicebroker.service.BeanCatalogService;
import org.springframework.cloud.servicebroker.service.CatalogService;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import static org.springframework.cloud.servicebroker.model.BrokerApiVersion.API_VERSION_CURRENT;
package org.springframework.cloud.servicebroker.config;



@Configuration
@ComponentScan(basePackages = {"org.springframework.cloud.servicebroker"})
@ConditionalOnWebApplication
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
public class ServiceBrokerAutoConfiguration {

	@Bean
	@ConditionalOnMissingBean(BrokerApiVersion.class)
	public BrokerApiVersion brokerApiVersion() {
// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/model/BrokerApiVersion.java
// @Getter
// @ToString
// @EqualsAndHashCode
// public class BrokerApiVersion {
// 
// 	public final static String DEFAULT_API_VERSION_HEADER = "X-Broker-Api-Version";
// 	public final static String API_VERSION_ANY = "*";
// 	public final static String API_VERSION_CURRENT = "2.8";
// 
// 	/**
// 	 * The name of the HTTP header field expected to contain the API version of the service broker client.
// 	 */
// 	private final String brokerApiVersionHeader;
// 
// 	/**
// 	 * The version of the broker API supported by the broker. A value of <code>null</code> or
// 	 * <code>API_VERSION_ANY</code> will disable API version validation.
// 	 */
// 	private final String apiVersion;
// 
// 	public BrokerApiVersion(String brokerApiVersionHeader, String apiVersion) {
// 		this.brokerApiVersionHeader = brokerApiVersionHeader;
// 		this.apiVersion = apiVersion;
// 	}
// 
// 	public BrokerApiVersion(String apiVersion) {
// 		this(DEFAULT_API_VERSION_HEADER, apiVersion);
// 	}
// 
// 	public BrokerApiVersion() {
// 		this(DEFAULT_API_VERSION_HEADER, API_VERSION_ANY);
// 	}
// }
// 
// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/model/Catalog.java
// @Getter
// @ToString
// @EqualsAndHashCode
// @JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE)
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class Catalog {
// 
// 	/**
// 	 * A list of service offerings provided by the service broker.
// 	 */
// 	@NotEmpty
// 	@JsonSerialize(nullsUsing = EmptyListSerializer.class)
// 	@JsonProperty("services")
// 	private final List<ServiceDefinition> serviceDefinitions;
// 
// 	public Catalog() {
// 		this.serviceDefinitions = null;
// 	}
// 
// 	public Catalog(List<ServiceDefinition> serviceDefinitions) {
// 		this.serviceDefinitions = serviceDefinitions;
// 	}
// }
// 
// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/service/BeanCatalogService.java
// public class BeanCatalogService implements CatalogService {
// 
// 	private Catalog catalog;
// 	private Map<String,ServiceDefinition> serviceDefs = new HashMap<String,ServiceDefinition>();
// 	
// 	@Autowired
// 	public BeanCatalogService(Catalog catalog) {
// 		this.catalog = catalog;
// 		initializeMap();
// 	}
// 	
// 	private void initializeMap() {
// 		for (ServiceDefinition def: catalog.getServiceDefinitions()) {
// 			serviceDefs.put(def.getId(), def);
// 		}
// 	}
// 	
// 	@Override
// 	public Catalog getCatalog() {
// 		return catalog;
// 	}
// 
// 	@Override
// 	public ServiceDefinition getServiceDefinition(String serviceId) {
// 		return serviceDefs.get(serviceId);
// 	}
// 
// }
// 
// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/service/CatalogService.java
// public interface CatalogService {
// 
// 	/**
// 	 * Return the catalog of services provided by the service broker.
// 	 *
// 	 * @return the catalog of services
// 	 */
// 	Catalog getCatalog();
// 
// 	/**
// 	 * Get a service definition from the catalog by ID.
// 	 *
// 	 * @param serviceId  The ID of the service definition in the catalog
// 	 * @return the service definition, or null if it doesn't exist
// 	 */
// 	ServiceDefinition getServiceDefinition(String serviceId);
// 	
// }
// 
// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/model/BrokerApiVersion.java
// public final static String API_VERSION_CURRENT = "2.8";


// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/config/ServiceBrokerAutoConfiguration.java
import org.springframework.cloud.servicebroker.model.BrokerApiVersion;
import org.springframework.cloud.servicebroker.model.Catalog;
import org.springframework.cloud.servicebroker.service.BeanCatalogService;
import org.springframework.cloud.servicebroker.service.CatalogService;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import static org.springframework.cloud.servicebroker.model.BrokerApiVersion.API_VERSION_CURRENT;

package org.springframework.cloud.servicebroker.config;



@Configuration
@ComponentScan(basePackages = {"org.springframework.cloud.servicebroker"})
@ConditionalOnWebApplication
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
public class ServiceBrokerAutoConfiguration {

	@Bean
	@ConditionalOnMissingBean(BrokerApiVersion.class)
	public BrokerApiVersion brokerApiVersion() {
		return new BrokerApiVersion(API_VERSION_CURRENT);