package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * UGC 作品状态枚举
 */
@Getter
@AllArgsConstructor
public enum UserWorkStatusEnum {

    DRAFT("draft", "草稿"),
    PENDING_REVIEW("pending_review", "待审核"),
    PUBLISHED("published", "已发布"),
    REJECTED("rejected", "已拒绝"),
    TAKEN_DOWN("taken_down", "已下架");

    private final String code;
    private final String desc;

    public static UserWorkStatusEnum getByCode(String code) {
        if (code == null) {
            return DRAFT;
        }
        for (UserWorkStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return DRAFT;
    }
}
