001
002package com.commercetools.api.models.business_unit;
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>Determines whether an AssociateRoleAssignment can be inherited by child Business Units.</p>
015 */
016@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
017public interface AssociateRoleInheritanceMode extends JsonEnum {
018
019    /**
020        <p>The assignment can be inherited by child Business Units.</p>
021
022    */
023    AssociateRoleInheritanceMode ENABLED = AssociateRoleInheritanceModeEnum.ENABLED;
024    /**
025        <p>The assignment cannot be inherited by child Business Units.</p>
026
027    */
028    AssociateRoleInheritanceMode DISABLED = AssociateRoleInheritanceModeEnum.DISABLED;
029
030    /**
031     * possible values of AssociateRoleInheritanceMode
032     */
033    enum AssociateRoleInheritanceModeEnum implements AssociateRoleInheritanceMode {
034        /**
035         * Enabled
036         */
037        ENABLED("Enabled"),
038
039        /**
040         * Disabled
041         */
042        DISABLED("Disabled");
043        private final String jsonName;
044
045        private AssociateRoleInheritanceModeEnum(final String jsonName) {
046            this.jsonName = jsonName;
047        }
048
049        public String getJsonName() {
050            return jsonName;
051        }
052
053        public String toString() {
054            return jsonName;
055        }
056    }
057
058    /**
059     * the JSON value
060     * @return json value
061     */
062    @JsonValue
063    String getJsonName();
064
065    /**
066     * the enum value
067     * @return name
068     */
069    String name();
070
071    /**
072     * convert value to string
073     * @return string representation
074     */
075    String toString();
076
077    /**
078     * factory method for a enum value of AssociateRoleInheritanceMode
079     * if no enum has been found an anonymous instance will be created
080     * @param value the enum value to be wrapped
081     * @return enum instance
082     */
083    @JsonCreator
084    public static AssociateRoleInheritanceMode findEnum(String value) {
085        return findEnumViaJsonName(value).orElse(new AssociateRoleInheritanceMode() {
086            @Override
087            public String getJsonName() {
088                return value;
089            }
090
091            @Override
092            public String name() {
093                return value.toUpperCase();
094            }
095
096            public String toString() {
097                return value;
098            }
099        });
100    }
101
102    /**
103     * method to find enum using the JSON value
104     * @param jsonName the json value to be wrapped
105     * @return optional of enum instance
106     */
107    public static Optional<AssociateRoleInheritanceMode> findEnumViaJsonName(String jsonName) {
108        return Arrays.stream(values()).filter(t -> t.getJsonName().equals(jsonName)).findFirst();
109    }
110
111    /**
112     * possible enum values
113     * @return array of possible enum values
114     */
115    public static AssociateRoleInheritanceMode[] values() {
116        return AssociateRoleInheritanceModeEnum.values();
117    }
118
119}