package com.jeesharp.business.modules.setting.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 宫格介绍详情页布局，对应表字段 {@code cms_home_grid_intro.layout}。
 *
 * @author jeesharp
 * @since 2026-07-09
 */
@Getter
@AllArgsConstructor
public enum HomeGridIntroLayoutEnum {

    /**
     * 标准模式：标题、图集/封面、正文，带页面边距
     */
    STANDARD(0, "标准模式"),

    /**
     * 仅内容展示：只渲染正文，页面无边距
     */
    CONTENT_ONLY(1, "仅内容展示");

    private final Integer value;
    private final String desc;

    public static HomeGridIntroLayoutEnum fromValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (HomeGridIntroLayoutEnum e : values()) {
            if (e.value.equals(value)) {
                return e;
            }
        }
        return null;
    }

    public static String getDescByValue(Integer value) {
        HomeGridIntroLayoutEnum e = fromValue(value);
        return e != null ? e.getDesc() : "";
    }
}
