/*
 * Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
 *
 * 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.micode.notes.ui;

/**
 * 布局类型枚举
 * <p>
 * 定义笔记列表支持的所有布局类型，包括线性布局、网格布局和瀑布流布局。
 * 每种布局类型都有对应的显示名称和描述。
 * </p>
 */
public enum LayoutType {
    LINEAR("linear", "列表布局", "传统的垂直列表布局，适合大量笔记浏览"),
    GRID("grid", "网格布局", "网格排列布局，适合快速浏览和预览"),
    STAGGERED("staggered", "瀑布流布局", "错落有致的布局，适合不同长度的笔记展示");

    private final String key;
    private final String displayName;
    private final String description;

    LayoutType(String key, String displayName, String description) {
        this.key = key;
        this.displayName = displayName;
        this.description = description;
    }

    public String getKey() {
        return key;
    }

    public String getDisplayName() {
        return displayName;
    }

    public String getDescription() {
        return description;
    }

    public static LayoutType fromKey(String key) {
        for (LayoutType type : values()) {
            if (type.key.equals(key)) {
                return type;
            }
        }
        return LINEAR;
    }
}
