package com.ycwl.basic.pricing.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 商品分类枚举
 */
@Getter
@AllArgsConstructor
public enum ProductCategory {

    VLOG("VLOG", "Vlog类"),
    PHOTO("PHOTO", "照片类"),
    VIDEO("VIDEO", "视频类"),
    PRINT("PRINT", "打印类"),
    OTHER("OTHER", "其他");

    private final String code;
    private final String description;

    /**
     * 根据代码获取枚举
     */
    public static ProductCategory fromCode(String code) {
        for (ProductCategory category : values()) {
            if (category.code.equals(code)) {
                return category;
            }
        }
        throw new IllegalArgumentException("Unknown product category code: " + code);
    }
}
