// Path: microservices-dashboard-server-core/src/main/java/be/ordina/msdashboard/applicationinstance/events/ActuatorEndpointsUpdated.java
// public class ActuatorEndpointsUpdated extends ApplicationEvent {
// 
// 	public ActuatorEndpointsUpdated(ApplicationInstance instance) {
// 		super(instance);
// 	}
// 
// 	public ApplicationInstance getApplicationInstance() {
// 		return (ApplicationInstance) this.source;
// 	}
// 
// }
// 
// Path: microservices-dashboard-server-core/src/main/java/be/ordina/msdashboard/applicationinstance/events/ApplicationInstanceCreated.java
// public class ApplicationInstanceCreated extends ApplicationEvent {
// 
// 	public ApplicationInstanceCreated(ApplicationInstance instance) {
// 		super(instance);
// 	}
// 
// 	public ApplicationInstance getApplicationInstance() {
// 		return (ApplicationInstance) this.source;
// 	}
// 
// }
// 
// Path: microservices-dashboard-server-core/src/main/java/be/ordina/msdashboard/applicationinstance/events/ApplicationInstanceDeleted.java
// public class ApplicationInstanceDeleted extends ApplicationEvent {
// 
// 	public ApplicationInstanceDeleted(ApplicationInstance instance) {
// 		super(instance);
// 	}
// 
// 	public ApplicationInstance getApplicationInstance() {
// 		return (ApplicationInstance) this.source;
// 	}
// 
// }
// 
// Path: microservices-dashboard-server-core/src/main/java/be/ordina/msdashboard/applicationinstance/events/ApplicationInstanceHealthUpdated.java
// public class ApplicationInstanceHealthUpdated extends ApplicationEvent {
// 
// 	public ApplicationInstanceHealthUpdated(ApplicationInstance instance) {
// 		super(instance);
// 	}
// 
// }


import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import be.ordina.msdashboard.applicationinstance.events.ActuatorEndpointsUpdated;
import be.ordina.msdashboard.applicationinstance.events.ApplicationInstanceCreated;
import be.ordina.msdashboard.applicationinstance.events.ApplicationInstanceDeleted;
import be.ordina.msdashboard.applicationinstance.events.ApplicationInstanceHealthUpdated;
import org.springframework.boot.actuate.health.Status;
import org.springframework.context.ApplicationEvent;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Links;
/*
 * Copyright 2015-2019 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package be.ordina.msdashboard.applicationinstance;




/**
 * The representation of an application's instance.
 *
 * @author Tim Ysewyn
 * @author Steve De Zitter
 */
public final class ApplicationInstance {

	private List<ApplicationEvent> changes = new ArrayList<>();

	private final String id;
	private final String application;
	private final URI baseUri;
	private State state;
	private Status healthStatus = Status.UNKNOWN;
	private Links actuatorEndpoints = new Links();

	private ApplicationInstance(Builder builder) {
		this.id = builder.id;
		this.application = builder.application;
		this.baseUri = builder.baseUri;
		this.state = State.CREATED;
// Path: microservices-dashboard-server-core/src/main/java/be/ordina/msdashboard/applicationinstance/events/ActuatorEndpointsUpdated.java
// public class ActuatorEndpointsUpdated extends ApplicationEvent {
// 
// 	public ActuatorEndpointsUpdated(ApplicationInstance instance) {
// 		super(instance);
// 	}
// 
// 	public ApplicationInstance getApplicationInstance() {
// 		return (ApplicationInstance) this.source;
// 	}
// 
// }
// 
// Path: microservices-dashboard-server-core/src/main/java/be/ordina/msdashboard/applicationinstance/events/ApplicationInstanceCreated.java
// public class ApplicationInstanceCreated extends ApplicationEvent {
// 
// 	public ApplicationInstanceCreated(ApplicationInstance instance) {
// 		super(instance);
// 	}
// 
// 	public ApplicationInstance getApplicationInstance() {
// 		return (ApplicationInstance) this.source;
// 	}
// 
// }
// 
// Path: microservices-dashboard-server-core/src/main/java/be/ordina/msdashboard/applicationinstance/events/ApplicationInstanceDeleted.java
// public class ApplicationInstanceDeleted extends ApplicationEvent {
// 
// 	public ApplicationInstanceDeleted(ApplicationInstance instance) {
// 		super(instance);
// 	}
// 
// 	public ApplicationInstance getApplicationInstance() {
// 		return (ApplicationInstance) this.source;
// 	}
// 
// }
// 
// Path: microservices-dashboard-server-core/src/main/java/be/ordina/msdashboard/applicationinstance/events/ApplicationInstanceHealthUpdated.java
// public class ApplicationInstanceHealthUpdated extends ApplicationEvent {
// 
// 	public ApplicationInstanceHealthUpdated(ApplicationInstance instance) {
// 		super(instance);
// 	}
// 
// }


// Path: microservices-dashboard-server-core/src/main/java/be/ordina/msdashboard/applicationinstance/ApplicationInstance.java
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import be.ordina.msdashboard.applicationinstance.events.ActuatorEndpointsUpdated;
import be.ordina.msdashboard.applicationinstance.events.ApplicationInstanceCreated;
import be.ordina.msdashboard.applicationinstance.events.ApplicationInstanceDeleted;
import be.ordina.msdashboard.applicationinstance.events.ApplicationInstanceHealthUpdated;
import org.springframework.boot.actuate.health.Status;
import org.springframework.context.ApplicationEvent;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Links;

/*
 * Copyright 2015-2019 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package be.ordina.msdashboard.applicationinstance;




/**
 * The representation of an application's instance.
 *
 * @author Tim Ysewyn
 * @author Steve De Zitter
 */
public final class ApplicationInstance {

	private List<ApplicationEvent> changes = new ArrayList<>();

	private final String id;
	private final String application;
	private final URI baseUri;
	private State state;
	private Status healthStatus = Status.UNKNOWN;
	private Links actuatorEndpoints = new Links();

	private ApplicationInstance(Builder builder) {
		this.id = builder.id;
		this.application = builder.application;
		this.baseUri = builder.baseUri;
		this.state = State.CREATED;
		this.changes.add(new ApplicationInstanceCreated(this));