/**
 * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
 *
 * 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 io.gravitee.definition.model;

/**
 * @author David BRASSELY (brasseld at gmail.com)
 * @author Gravitee.io Team
 */
public class Endpoint {

    public static int DEFAULT_WEIGHT = 1;

    private String target;

    private int weight = DEFAULT_WEIGHT;

    private boolean backup;

    private boolean healthcheck = true;

    public Endpoint(String target) {
        this();
        this.target = target;
    }

    public Endpoint() {
        this.weight = DEFAULT_WEIGHT;
    }

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }

    public boolean isBackup() {
        return backup;
    }

    public void setBackup(boolean backup) {
        this.backup = backup;
    }

    public boolean isHealthcheck() {
        return healthcheck;
    }

    public void setHealthcheck(boolean healthcheck) {
        this.healthcheck = healthcheck;
    }
}

@@ -957,16 +957,56 @@
  true;%0A%0A
+    private Status status = Status.UP;%0A%0A
     publ
@@ -1748,11 +1748,850 @@
 k;%0A    %7D
+%0A%0A    public Status getStatus() %7B%0A        return status;%0A    %7D%0A%0A    public void setStatus(Status status) %7B%0A        this.status = status;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object o) %7B%0A        if (this == o) return true;%0A        if (o == null %7C%7C getClass() != o.getClass()) return false;%0A%0A        Endpoint endpoint = (Endpoint) o;%0A%0A        return target != null ? target.equals(endpoint.target) : endpoint.target == null;%0A%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return target != null ? target.hashCode() : 0;%0A    %7D%0A%0A    public enum Status %7B%0A        UP(3),%0A        DOWN(0),%0A        TRANSITIONALLY_DOWN(1),%0A        TRANSITIONALLY_UP(2);%0A%0A        private final int code;%0A%0A        Status(int code) %7B%0A            this.code = code;%0A        %7D%0A%0A        public int code() %7B%0A            return this.code;%0A        %7D%0A    %7D
 %0A%7D%0A

Add a state to the endpoint (#19)