/*
 * Copyright (c) 2017-present, Takayuki Maruyama
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package net.bis5.mattermost.model;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.io.IOException;
import java.util.Arrays;
import lombok.Getter;
import net.bis5.mattermost.model.PreferenceCategory.PreferenceCategoryDeserializer;
import net.bis5.mattermost.model.serialize.HasCodeSerializer;

/**
 * The type of preference category.
 * 
 * @author Takayuki Maruyama
 */
@JsonSerialize(using = HasCodeSerializer.class)
@JsonDeserialize(using = PreferenceCategoryDeserializer.class)
@Getter
public enum PreferenceCategory implements HasCode<PreferenceCategory> {

  DIRECT_CHANNEL_SHOW("direct_channel_show"), TUTORIAL_STEPS("tutorial_step"), ADVANCED_SETTINGS(
      "advanced_settings"), FLAGGED_POST("flagged_post"), //
  DISPLAY_SETTINGS("display_settings"), THEME("theme"), AUTHORIZED_OAUTH_APP("oauth_app"), LAST(
      "last"), NOTIFICATIONS("notifications");
  private final String code;

  private PreferenceCategory(String code) {
    this.code = code;
  }

  public static PreferenceCategory of(String code) {
    return Arrays.stream(values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
  }

  static class PreferenceCategoryDeserializer extends JsonDeserializer<PreferenceCategory> {

    @Override
    public PreferenceCategory deserialize(JsonParser p, DeserializationContext ctxt)
        throws IOException {
      String jsonValue = p.getText();
      return of(jsonValue);
    }
  }
}

@@ -1503,16 +1503,105 @@
 _show%22),
+%0D%0A  /** @since Mattermost Server 5.26 */%0D%0A  GROUOP_CHANNEL_SHOW(%22group_channel_show%22),%0D%0A 
  TUTORIA
@@ -1625,16 +1625,19 @@
 _step%22),
+%0D%0A 
  ADVANCE
@@ -1647,24 +1647,16 @@
 ETTINGS(
-%0D%0A      
 %22advance
@@ -1668,16 +1668,19 @@
 tings%22),
+%0D%0A 
  FLAGGED
@@ -1705,52 +1705,305 @@
 t%22),
- //%0D%0A  DISPLAY_SETTINGS(%22display_settings%22),
+%0D%0A  /** @since Mattermost Server 4.1 */%0D%0A  FAVORITE_CHANNEL(%22favorite_channel%22),%0D%0A  /** @since Mattermost Server 5.4 */%0D%0A  SIDEBAR_SETTINGS(%22sidebar_settings%22),%0D%0A  DISPLAY_SETTINGS(%22display_settings%22),%0D%0A  /** @since Mattermost Server 5.38 */%0D%0A  RECOMMENDED_NEXT_STEPS(%22recommended_next_steps%22),%0D%0A 
  THE
@@ -2014,16 +2014,19 @@
 theme%22),
+%0D%0A 
  AUTHORI
@@ -2056,30 +2056,25 @@
 p%22),
+%0D%0A 
  LAST(
-%0D%0A      
 %22last%22),
  NOT
@@ -2069,16 +2069,94 @@
 %22last%22),
+%0D%0A  /** @since Mattermost Server 5.33 */%0D%0A  CUSTOM_STATUS(%22custom_status%22),%0D%0A 
  NOTIFIC

Add missing preference categories