package com.starry.common.enums; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; /** * 店员资料审核状态枚举,集中维护状态代码及含义。 */ @ApiModel(value = "店员资料审核状态", description = "店员资料审核状态枚举,避免魔法值") public enum ClerkReviewState { PENDING("0", "未审核"), APPROVED("1", "审核通过"), REJECTED("2", "审核不通过"); private final String code; private final String description; ClerkReviewState(String code, String description) { this.code = code; this.description = description; } @JsonValue public String getCode() { return code; } public String getDescription() { return description; } @JsonCreator public static ClerkReviewState fromCode(String code) { if (code == null) { return null; } for (ClerkReviewState state : ClerkReviewState.values()) { if (state.code.equals(code)) { return state; } } throw new IllegalArgumentException("Unknown ClerkReviewState code: " + code); } }