001
002package com.commercetools.importapi.models.orders;
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 *  <p>Maps to <code>Order.shipmentState</code>.</p>
015 */
016@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
017public interface ShipmentState extends JsonEnum {
018
019    ShipmentState SHIPPED = ShipmentStateEnum.SHIPPED;
020
021    ShipmentState READY = ShipmentStateEnum.READY;
022
023    ShipmentState PENDING = ShipmentStateEnum.PENDING;
024
025    ShipmentState DELAYED = ShipmentStateEnum.DELAYED;
026
027    ShipmentState PARTIAL = ShipmentStateEnum.PARTIAL;
028
029    ShipmentState BACKORDER = ShipmentStateEnum.BACKORDER;
030
031    /**
032     * possible values of ShipmentState
033     */
034    enum ShipmentStateEnum implements ShipmentState {
035        /**
036         * Shipped
037         */
038        SHIPPED("Shipped"),
039
040        /**
041         * Ready
042         */
043        READY("Ready"),
044
045        /**
046         * Pending
047         */
048        PENDING("Pending"),
049
050        /**
051         * Delayed
052         */
053        DELAYED("Delayed"),
054
055        /**
056         * Partial
057         */
058        PARTIAL("Partial"),
059
060        /**
061         * Backorder
062         */
063        BACKORDER("Backorder");
064        private final String jsonName;
065
066        private ShipmentStateEnum(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 ShipmentState
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 ShipmentState findEnum(String value) {
106        return findEnumViaJsonName(value).orElse(new ShipmentState() {
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<ShipmentState> 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 ShipmentState[] values() {
137        return ShipmentStateEnum.values();
138    }
139
140}