/*
 * (c) Copyright 2015-2016 Micro Focus or one of its affiliates.
 *
 * Licensed under the MIT License (the "License"); you may not use this file
 * except in compliance with the License.
 *
 * The only warranties for products and services of Micro Focus and its affiliates
 * and licensors ("Micro Focus") are as may be set forth in the express warranty
 * statements accompanying such products and services. Nothing herein should be
 * construed as constituting an additional warranty. Micro Focus shall not be
 * liable for technical or editorial errors or omissions contained herein. The
 * information contained herein is subject to change without notice.
 */

package com.hp.autonomy.types.requests.idol.actions.tags.params;

/**
 * FieldType parameter values
 */
@SuppressWarnings({"WeakerAccess", "unused"})
public enum FieldTypeParam {
    ACL,
    All,
    AutnRank,
    BitField,
    DataBase,
    Date,
    DocumentTracking,
    ExpireDate,
    FieldCheck,
    FlattenIndex,
    Highlight,
    Index,
    IndexWeight,
    InvertedAgent,
    Language,
    Match,
    NumericDate,
    Numeric,
    Parametric,
    Print,
    Reference,
    SectionBreak,
    Security,
    Sort,
    Source,
    Synonym,
    Title;

    public static FieldTypeParam fromValue(final String value) {
        for (final FieldTypeParam param : values()) {
            if (param.name().equalsIgnoreCase(value)) {
                return param;
            }
        }

        throw new IllegalArgumentException("Unknown query param " + value);
    }

    public static FieldTypeParam fromValue(final String value, final FieldTypeParam defaultValue) {
        FieldTypeParam match = defaultValue;

        for (final FieldTypeParam param : values()) {
            if (param.name().equalsIgnoreCase(value)) {
                match = param;
                break;
            }
        }

        return match;
    }
}

@@ -22,16 +22,22 @@
 015-2016
+, 2020
  Micro F
@@ -864,16 +864,33 @@
    All,%0A
+    AlwaysMatch,%0A
     Autn
@@ -1001,24 +1001,160 @@
 attenIndex,%0A
+    GeospatialUnified(%22geospatial (unified)%22),%0A    GeospatialX(%22geospatial (X/longitude)%22),%0A    GeospatialY(%22geospatial (Y/latitude)%22),%0A
     Highligh
@@ -1379,30 +1379,339 @@
 Title;%0A%0A    
-public
+/**%0A     * Additional optional ID used by IDOL for this field type.%0A     */%0A    private final String value;%0A%0A    FieldTypeParam(final String value) %7B%0A        this.value = value;%0A    %7D%0A%0A    FieldTypeParam() %7B%0A        this(null);%0A    %7D%0A%0A    /**%0A     * Return type matching the IDOL value, or null.%0A     */%0A    private
  static Fiel
@@ -1713,33 +1713,38 @@
  FieldTypeParam 
-f
+maybeF
 romValue(final S
@@ -1868,149 +1868,290 @@
 lue)
-) %7B%0A                return param;%0A            %7D%0A        %7D%0A%0A        throw new IllegalArgumentException(%22Unknown query param %22 + value);%0A    %7D%0A
+ %7C%7C%0A                (param.value != null && param.value.equalsIgnoreCase(value))%0A            ) %7B%0A                return param;%0A            %7D%0A        %7D%0A%0A        return null;%0A    %7D%0A%0A    /**%0A     * Return type matching the IDOL value, or throw %7B@link IllegalArgumentException%7D.%0A     */
 %0A   
@@ -2208,17 +2208,27 @@
 ng value
-,
+) %7B%0A       
  final F
@@ -2245,273 +2245,490 @@
 ram 
-defaultValue) %7B%0A        FieldTypeParam match = defaultValue;%0A%0A        for (final FieldTypeParam
+match = maybeFromValue(value);%0A        if (match == null) %7B%0A            throw new IllegalArgumentException(%22Unknown query
  param 
-:
+%22 +
  value
-s()) %7B
+);
 %0A      
+  %7D%0A
       
-if (param.name().equalsIgnoreCase(value)) %7B
+  return match;
 %0A    
+%7D%0A%0A
     
+/**%0A
      
-   match = param;%0A     
+* Return type matching the IDOL value, or return the provided default value.%0A
      
+*/%0A
     
-  break;%0A            %7D%0A        %7D%0A%0A        return
+public static FieldTypeParam fromValue(final String value, final FieldTypeParam defaultValue) %7B%0A        final FieldTypeParam match = maybeFromValue(value);%0A        return match == null ? defaultValue :
  mat

add some missing types