package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 参与者类型枚举
 */
@Getter
@AllArgsConstructor
public enum ParticipantTypeEnum {

    SELF("self", "自己"),
    CHILD("child", "代子女");

    private final String code;
    private final String desc;

    public static ParticipantTypeEnum getByCode(String code) {
        if (code == null) {
            return SELF;
        }
        for (ParticipantTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return SELF;
    }
}
