001
002package com.commercetools.history.models.common;
003
004import java.util.Arrays;
005import java.util.Optional;
006
007import com.fasterxml.jackson.annotation.JsonCreator;
008import com.fasterxml.jackson.annotation.JsonValue;
009
010import io.vrap.rmf.base.client.JsonEnum;
011import io.vrap.rmf.base.client.utils.Generated;
012
013/**
014 * QuoteState
015 */
016@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
017public interface QuoteState extends JsonEnum {
018
019    QuoteState PENDING = QuoteStateEnum.PENDING;
020
021    QuoteState DECLINED = QuoteStateEnum.DECLINED;
022
023    QuoteState DECLINED_FOR_RENEGOTIATION = QuoteStateEnum.DECLINED_FOR_RENEGOTIATION;
024
025    QuoteState ACCEPTED = QuoteStateEnum.ACCEPTED;
026
027    QuoteState FAILED = QuoteStateEnum.FAILED;
028
029    QuoteState WITHDRAWN = QuoteStateEnum.WITHDRAWN;
030
031    /**
032     * possible values of QuoteState
033     */
034    enum QuoteStateEnum implements QuoteState {
035        /**
036         * Pending
037         */
038        PENDING("Pending"),
039
040        /**
041         * Declined
042         */
043        DECLINED("Declined"),
044
045        /**
046         * DeclinedForRenegotiation
047         */
048        DECLINED_FOR_RENEGOTIATION("DeclinedForRenegotiation"),
049
050        /**
051         * Accepted
052         */
053        ACCEPTED("Accepted"),
054
055        /**
056         * Failed
057         */
058        FAILED("Failed"),
059
060        /**
061         * Withdrawn
062         */
063        WITHDRAWN("Withdrawn");
064        private final String jsonName;
065
066        private QuoteStateEnum(final String jsonName) {
067            this.jsonName = jsonName;
068        }
069
070        public String getJsonName() {
071            return jsonName;
072        }
073
074        public String toString() {
075            return jsonName;
076        }
077    }
078
079    /**
080     * the JSON value
081     * @return json value
082     */
083    @JsonValue
084    String getJsonName();
085
086    /**
087     * the enum value
088     * @return name
089     */
090    String name();
091
092    /**
093     * convert value to string
094     * @return string representation
095     */
096    String toString();
097
098    /**
099     * factory method for a enum value of QuoteState
100     * if no enum has been found an anonymous instance will be created
101     * @param value the enum value to be wrapped
102     * @return enum instance
103     */
104    @JsonCreator
105    public static QuoteState findEnum(String value) {
106        return findEnumViaJsonName(value).orElse(new QuoteState() {
107            @Override
108            public String getJsonName() {
109                return value;
110            }
111
112            @Override
113            public String name() {
114                return value.toUpperCase();
115            }
116
117            public String toString() {
118                return value;
119            }
120        });
121    }
122
123    /**
124     * method to find enum using the JSON value
125     * @param jsonName the json value to be wrapped
126     * @return optional of enum instance
127     */
128    public static Optional<QuoteState> findEnumViaJsonName(String jsonName) {
129        return Arrays.stream(values()).filter(t -> t.getJsonName().equals(jsonName)).findFirst();
130    }
131
132    /**
133     * possible enum values
134     * @return array of possible enum values
135     */
136    public static QuoteState[] values() {
137        return QuoteStateEnum.values();
138    }
139
140}