package com.ycwl.basic.pricing.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 商品类型枚举
 */
@Getter
@AllArgsConstructor
public enum ProductType {

    // VLOG类
    VLOG_VIDEO("VLOG_VIDEO", "Vlog视频", ProductCategory.VLOG),
    PHOTO_VLOG("PHOTO_VLOG", "pLog视频", ProductCategory.VLOG),

    // 照片类
    PHOTO("PHOTO", "照片", ProductCategory.PHOTO),
    PHOTO_SET("PHOTO_SET", "照片集", ProductCategory.PHOTO),
    AI_CAM_PHOTO_SET("AI_CAM_PHOTO_SET", "照片集", ProductCategory.PHOTO),
    PHOTO_LOG("PHOTO_LOG", "pLog图", ProductCategory.PHOTO),

    // 视频类（素材视频）
    RECORDING_SET("RECORDING_SET", "录像集", ProductCategory.VIDEO),

    // 其他类（打印类等）
    PHOTO_PRINT("PHOTO_PRINT", "照片打印", ProductCategory.PRINT),
    PHOTO_PRINT_MU("PHOTO_PRINT_MU", "手机照片打印", ProductCategory.PRINT),
    PHOTO_PRINT_FX("PHOTO_PRINT_FX", "特效照片打印", ProductCategory.PRINT),
    MACHINE_PRINT("MACHINE_PRINT", "一体机打印", ProductCategory.PRINT);

    private final String code;
    private final String description;
    private final ProductCategory category;

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

    /**
     * 获取分类代码
     */
    public String getCategoryCode() {
        return category.getCode();
    }

    /**
     * 获取分类描述
     */
    public String getCategoryDescription() {
        return category.getDescription();
    }
}