/*
 * WSO2 API Manager - Governance
 * This document specifies a **RESTful API** for WSO2 **API Manager** - Governance. 
 *
 * The version of the OpenAPI document: v1.1
 * Contact: architecture@wso2.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.wso2.am.integration.clients.governance.api.dto;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import com.fasterxml.jackson.annotation.JsonCreator;
/**
* Action to be taken when a governance policy is violated.
*/
    @ApiModel(description = "Action to be taken when a governance policy is violated.")

public class ActionDTO {
            /**
* The state of the artifact to which the action is linked to.
*/
    @JsonAdapter(StateEnum.Adapter.class)
public enum StateEnum {
        API_CREATE("API_CREATE"),
        
        API_UPDATE("API_UPDATE"),
        
        API_DEPLOY("API_DEPLOY"),
        
        API_PUBLISH("API_PUBLISH");

private String value;

StateEnum(String value) {
this.value = value;
}

public String getValue() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

public static StateEnum fromValue(String value) {
    for (StateEnum b : StateEnum.values()) {
    if (b.name().equals(value)) {
        return b;
    }
}
    throw new IllegalArgumentException("Unexpected value '" + value + "'");
}

    public static class Adapter extends TypeAdapter<StateEnum> {
    @Override
    public void write(final JsonWriter jsonWriter, final StateEnum enumeration) throws IOException {
    jsonWriter.value(enumeration.getValue());
    }

    @Override
    public StateEnum read(final JsonReader jsonReader) throws IOException {
    String value =  jsonReader.nextString();
    return StateEnum.fromValue(value);
    }
    }
}

        public static final String SERIALIZED_NAME_STATE = "state";
        @SerializedName(SERIALIZED_NAME_STATE)
            private StateEnum state;

            /**
* The severity of the rule to which the action is linked to.
*/
    @JsonAdapter(RuleSeverityEnum.Adapter.class)
public enum RuleSeverityEnum {
        ERROR("ERROR"),
        
        WARN("WARN"),
        
        INFO("INFO");

private String value;

RuleSeverityEnum(String value) {
this.value = value;
}

public String getValue() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

public static RuleSeverityEnum fromValue(String value) {
    for (RuleSeverityEnum b : RuleSeverityEnum.values()) {
    if (b.name().equals(value)) {
        return b;
    }
}
    throw new IllegalArgumentException("Unexpected value '" + value + "'");
}

    public static class Adapter extends TypeAdapter<RuleSeverityEnum> {
    @Override
    public void write(final JsonWriter jsonWriter, final RuleSeverityEnum enumeration) throws IOException {
    jsonWriter.value(enumeration.getValue());
    }

    @Override
    public RuleSeverityEnum read(final JsonReader jsonReader) throws IOException {
    String value =  jsonReader.nextString();
    return RuleSeverityEnum.fromValue(value);
    }
    }
}

        public static final String SERIALIZED_NAME_RULE_SEVERITY = "ruleSeverity";
        @SerializedName(SERIALIZED_NAME_RULE_SEVERITY)
            private RuleSeverityEnum ruleSeverity;

            /**
* The type of action to be taken when a governance policy is violated in the given state withe given rule severity.
*/
    @JsonAdapter(TypeEnum.Adapter.class)
public enum TypeEnum {
        BLOCK("BLOCK"),
        
        NOTIFY("NOTIFY");

private String value;

TypeEnum(String value) {
this.value = value;
}

public String getValue() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

public static TypeEnum fromValue(String value) {
    for (TypeEnum b : TypeEnum.values()) {
    if (b.name().equals(value)) {
        return b;
    }
}
    throw new IllegalArgumentException("Unexpected value '" + value + "'");
}

    public static class Adapter extends TypeAdapter<TypeEnum> {
    @Override
    public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException {
    jsonWriter.value(enumeration.getValue());
    }

    @Override
    public TypeEnum read(final JsonReader jsonReader) throws IOException {
    String value =  jsonReader.nextString();
    return TypeEnum.fromValue(value);
    }
    }
}

        public static final String SERIALIZED_NAME_TYPE = "type";
        @SerializedName(SERIALIZED_NAME_TYPE)
            private TypeEnum type;


        public ActionDTO state(StateEnum state) {
        
        this.state = state;
        return this;
        }

    /**
        * The state of the artifact to which the action is linked to.
    * @return state
    **/
        @javax.annotation.Nullable
      @ApiModelProperty(example = "API_DEPLOY", value = "The state of the artifact to which the action is linked to.")
    
    public StateEnum getState() {
        return state;
    }


    public void setState(StateEnum state) {
        this.state = state;
    }


        public ActionDTO ruleSeverity(RuleSeverityEnum ruleSeverity) {
        
        this.ruleSeverity = ruleSeverity;
        return this;
        }

    /**
        * The severity of the rule to which the action is linked to.
    * @return ruleSeverity
    **/
        @javax.annotation.Nullable
      @ApiModelProperty(example = "ERROR", value = "The severity of the rule to which the action is linked to.")
    
    public RuleSeverityEnum getRuleSeverity() {
        return ruleSeverity;
    }


    public void setRuleSeverity(RuleSeverityEnum ruleSeverity) {
        this.ruleSeverity = ruleSeverity;
    }


        public ActionDTO type(TypeEnum type) {
        
        this.type = type;
        return this;
        }

    /**
        * The type of action to be taken when a governance policy is violated in the given state withe given rule severity.
    * @return type
    **/
        @javax.annotation.Nullable
      @ApiModelProperty(example = "BLOCK", value = "The type of action to be taken when a governance policy is violated in the given state withe given rule severity.")
    
    public TypeEnum getType() {
        return type;
    }


    public void setType(TypeEnum type) {
        this.type = type;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
        return true;
        }
        if (o == null || getClass() != o.getClass()) {
        return false;
        }
            ActionDTO action = (ActionDTO) o;
            return Objects.equals(this.state, action.state) &&
            Objects.equals(this.ruleSeverity, action.ruleSeverity) &&
            Objects.equals(this.type, action.type);
    }

    @Override
    public int hashCode() {
        return Objects.hash(state, ruleSeverity, type);
    }


@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ActionDTO {\n");
    sb.append("    state: ").append(toIndentedString(state)).append("\n");
    sb.append("    ruleSeverity: ").append(toIndentedString(ruleSeverity)).append("\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n    ");
}

}

